create method
Creates an instance of a video player and returns its textureId.
Implementation
@override
Future<int?> create(DataSource? dataSource) async {
Map<String, dynamic>? dataSourceDescription;
switch (dataSource!.sourceType) {
case DataSourceType.asset:
dataSourceDescription = <String, dynamic>{
'asset': dataSource.asset,
'package': dataSource.package,
};
break;
case DataSourceType.network:
dataSourceDescription = <String, dynamic>{
'uri': dataSource.uri,
'formatHint': _videoFormatStringMap[dataSource.formatHint]
};
break;
case DataSourceType.file:
dataSourceDescription = <String, dynamic>{'uri': dataSource.uri};
break;
}
final Map<String, dynamic>? response =
await (_channel.invokeMapMethod<String, dynamic>(
'create',
dataSourceDescription,
));
return response!['textureId'];
}