RemoteMediaClient GetMediaInfo used in example
This commit is contained in:
parent
cf5e1a0904
commit
73e30bb8c8
3 changed files with 24 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_cast_framework/cast.dart';
|
import 'package:flutter_cast_framework/cast.dart';
|
||||||
import 'package:flutter_cast_framework/widgets.dart';
|
import 'package:flutter_cast_framework/widgets.dart';
|
||||||
|
|
@ -79,6 +81,15 @@ class _MyAppState extends State<MyApp> {
|
||||||
castFramework.castContext.sessionManager.remoteMediaClient.load(request);
|
castFramework.castContext.sessionManager.remoteMediaClient.load(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _openExpandedControls() async {
|
||||||
|
final remoteMediaClient =
|
||||||
|
this.castFramework.castContext.sessionManager.remoteMediaClient;
|
||||||
|
|
||||||
|
final mediaInfo = await remoteMediaClient.getMediaInfo();
|
||||||
|
debugPrint("$mediaInfo");
|
||||||
|
inspect(mediaInfo);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildTitle(String text) {
|
Widget _buildTitle(String text) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
|
@ -138,6 +149,13 @@ class _MyAppState extends State<MyApp> {
|
||||||
child: Text('Cast video'),
|
child: Text('Cast video'),
|
||||||
onPressed: _onCastVideo,
|
onPressed: _onCastVideo,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
child: Text('Expanded Controls'),
|
||||||
|
onPressed: _openExpandedControls,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,8 @@ class RemoteMediaClient {
|
||||||
void load(MediaLoadRequestData request) {
|
void load(MediaLoadRequestData request) {
|
||||||
_hostApi.loadMediaLoadRequestData(request);
|
_hostApi.loadMediaLoadRequestData(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<MediaInfo> getMediaInfo() async {
|
||||||
|
return await _hostApi.getMediaInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import 'PlatformBridgeApis.dart';
|
||||||
import 'cast/CastContext.dart';
|
import 'cast/CastContext.dart';
|
||||||
|
|
||||||
class FlutterCastFramework extends CastFlutterApi {
|
class FlutterCastFramework extends CastFlutterApi {
|
||||||
final hostApi = CastHostApi();
|
final _hostApi = CastHostApi();
|
||||||
late CastContext castContext;
|
late CastContext castContext;
|
||||||
|
|
||||||
/// List of namespaces to listen for custom messages
|
/// List of namespaces to listen for custom messages
|
||||||
|
|
@ -14,7 +14,7 @@ class FlutterCastFramework extends CastFlutterApi {
|
||||||
FlutterCastFramework.create(List<String> namespaces) {
|
FlutterCastFramework.create(List<String> namespaces) {
|
||||||
debugPrint("FlutterCastFramework created!");
|
debugPrint("FlutterCastFramework created!");
|
||||||
this.namespaces = namespaces;
|
this.namespaces = namespaces;
|
||||||
this.castContext = CastContext(hostApi);
|
this.castContext = CastContext(_hostApi);
|
||||||
CastFlutterApi.setup(this);
|
CastFlutterApi.setup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue