support flutter gstreamer player for iOS

This commit is contained in:
hpdragon
2022-12-09 01:02:56 +07:00
parent 9fd8c9f2da
commit af6f0e132c
56 changed files with 2839 additions and 81 deletions
+24 -5
View File
@@ -65,10 +65,29 @@ class _GstPlayerState extends State<GstPlayer> {
@override
Widget build(BuildContext context) {
return Container(
child: _controller.isInitialized
? Texture(textureId: _controller.textureId)
: null,
);
var currentPlatform = Theme.of(context).platform;
switch (currentPlatform) {
case TargetPlatform.linux:
case TargetPlatform.android:
return Container(
child: _controller.isInitialized
? Texture(textureId: _controller.textureId)
: null,
);
break;
case TargetPlatform.iOS:
String viewType = _controller.textureId.toString();
final Map<String, dynamic> creationParams = <String, dynamic>{};
return UiKitView(
viewType: viewType,
layoutDirection: TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec(),
);
break;
default:
throw UnsupportedError('Unsupported platform view');
}
}
}