Opentok fixes

merge-update-with-lab-changes
haroon amjad 3 years ago
parent 22274ebbb0
commit c289afb186

@ -107,13 +107,13 @@ class OpenTokState extends State<OpenTokConnectCallPage> {
List<Widget> platformVideoViews() { List<Widget> platformVideoViews() {
return [ return [
SizedBox(width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, child: remoteVideoOnFull ? remotePlatformVideoView() : localPlatformVideoView()), SizedBox(width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, child: remoteVideoOnFull ? returnFlutterNewRemoteWidget() : returnFlutterNewLocalWidget()),
DraggablePublisher( DraggablePublisher(
onButtonBarHeight: ((double) async* {}(50)), onButtonBarHeight: ((double) async* {}(50)),
onButtonBarVisible: ((bool) async* {}(true)), onButtonBarVisible: ((bool) async* {}(true)),
availableScreenSize: MediaQuery.of(context).size, availableScreenSize: MediaQuery.of(context).size,
child: InkWell( child: InkWell(
child: (remoteVideoOnFull ? localPlatformVideoView() : remotePlatformVideoView()), child: (remoteVideoOnFull ? returnFlutterNewLocalWidget() : returnFlutterNewRemoteWidget()),
onTap: () { onTap: () {
print(''); print('');
}, },
@ -122,57 +122,87 @@ class OpenTokState extends State<OpenTokConnectCallPage> {
]; ];
} }
Widget localPlatformVideoView() { // Widget localPlatformVideoView() {
return PlatformViewLink( // return PlatformViewLink(
viewType: 'local-video-container', // custom platform-view-type // viewType: 'local-video-container', // custom platform-view-type
surfaceFactory: (BuildContext context, PlatformViewController controller) { // surfaceFactory: (BuildContext context, PlatformViewController controller) {
return AndroidViewSurface( // return AndroidViewSurface(
controller: controller, // controller: controller,
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{}, // gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
hitTestBehavior: PlatformViewHitTestBehavior.opaque, // hitTestBehavior: PlatformViewHitTestBehavior.opaque,
); // );
}, // },
//
onCreatePlatformView: (PlatformViewCreationParams params) { // onCreatePlatformView: (PlatformViewCreationParams params) {
return PlatformViewsService.initSurfaceAndroidView( // return PlatformViewsService.initSurfaceAndroidView(
id: params.id, // id: params.id,
viewType: 'local-video-container', // viewType: 'local-video-container',
// custom platform-view-type, // // custom platform-view-type,
layoutDirection: TextDirection.ltr, // layoutDirection: TextDirection.ltr,
creationParams: {}, // creationParams: {},
creationParamsCodec: StandardMessageCodec(), // creationParamsCodec: StandardMessageCodec(),
) // )
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) // ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create(); // ..create();
}, // },
); // );
// }
Widget returnFlutterNewRemoteWidget() {
final Map<String, String> args = {"someInit": "initData"};
const StandardMessageCodec _decoder = StandardMessageCodec();
if (defaultTargetPlatform == TargetPlatform.android) {
return AndroidView(
viewType: 'remote-video-container',
creationParams: args,
creationParamsCodec: _decoder);
}
return UiKitView(
viewType: 'remote-video-container',
creationParams: args,
creationParamsCodec: _decoder);
} }
Widget remotePlatformVideoView() { Widget returnFlutterNewLocalWidget() {
return PlatformViewLink( final Map<String, String> args = {"someInit": "initData"};
viewType: 'remote-video-container', // custom platform-view-type const StandardMessageCodec _decoder = StandardMessageCodec();
surfaceFactory: (BuildContext context, PlatformViewController controller) { if (defaultTargetPlatform == TargetPlatform.android) {
return AndroidViewSurface( return AndroidView(
controller: controller, viewType: 'local-video-container',
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{}, creationParams: args,
hitTestBehavior: PlatformViewHitTestBehavior.opaque, creationParamsCodec: _decoder);
); }
}, return UiKitView(
onCreatePlatformView: (PlatformViewCreationParams params) { viewType: 'local-video-container',
return PlatformViewsService.initSurfaceAndroidView( creationParams: args,
id: params.id, creationParamsCodec: _decoder);
viewType: 'remote-video-container',
// custom platform-view-type,
layoutDirection: TextDirection.ltr,
creationParams: {},
creationParamsCodec: StandardMessageCodec(),
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},
);
} }
// Widget remotePlatformVideoView() {
// return PlatformViewLink(
// viewType: 'remote-video-container', // custom platform-view-type
// surfaceFactory: (BuildContext context, PlatformViewController controller) {
// return AndroidViewSurface(
// controller: controller,
// gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
// hitTestBehavior: PlatformViewHitTestBehavior.opaque,
// );
// },
// onCreatePlatformView: (PlatformViewCreationParams params) {
// return PlatformViewsService.initSurfaceAndroidView(
// id: params.id,
// viewType: 'remote-video-container',
// // custom platform-view-type,
// layoutDirection: TextDirection.ltr,
// creationParams: {},
// creationParamsCodec: StandardMessageCodec(),
// )
// ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
// ..create();
// },
// );
// }
_onAudioEnable() async { _onAudioEnable() async {
await openTokPlatform.toggleAudio(); await openTokPlatform.toggleAudio();
_audioButton.add(!audioMute); _audioButton.add(!audioMute);

Loading…
Cancel
Save