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() {
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(
onButtonBarHeight: ((double) async* {}(50)),
onButtonBarVisible: ((bool) async* {}(true)),
availableScreenSize: MediaQuery.of(context).size,
child: InkWell(
child: (remoteVideoOnFull ? localPlatformVideoView() : remotePlatformVideoView()),
child: (remoteVideoOnFull ? returnFlutterNewLocalWidget() : returnFlutterNewRemoteWidget()),
onTap: () {
print('');
},
@ -122,57 +122,87 @@ class OpenTokState extends State<OpenTokConnectCallPage> {
];
}
Widget localPlatformVideoView() {
return PlatformViewLink(
viewType: 'local-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: 'local-video-container',
// custom platform-view-type,
layoutDirection: TextDirection.ltr,
creationParams: {},
creationParamsCodec: StandardMessageCodec(),
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},
);
// Widget localPlatformVideoView() {
// return PlatformViewLink(
// viewType: 'local-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: 'local-video-container',
// // custom platform-view-type,
// layoutDirection: TextDirection.ltr,
// creationParams: {},
// creationParamsCodec: StandardMessageCodec(),
// )
// ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
// ..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);
}
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,
return UiKitView(
viewType: 'remote-video-container',
// custom platform-view-type,
layoutDirection: TextDirection.ltr,
creationParams: {},
creationParamsCodec: StandardMessageCodec(),
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},
);
creationParams: args,
creationParamsCodec: _decoder);
}
Widget returnFlutterNewLocalWidget() {
final Map<String, String> args = {"someInit": "initData"};
const StandardMessageCodec _decoder = StandardMessageCodec();
if (defaultTargetPlatform == TargetPlatform.android) {
return AndroidView(
viewType: 'local-video-container',
creationParams: args,
creationParamsCodec: _decoder);
}
return UiKitView(
viewType: 'local-video-container',
creationParams: args,
creationParamsCodec: _decoder);
}
// 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 {
await openTokPlatform.toggleAudio();
_audioButton.add(!audioMute);

Loading…
Cancel
Save