create method

  1. @override
Future<int?> create(
  1. DataSource dataSource
)
override

Implementation

@override
Future<int?> create(DataSource dataSource) async {
  CreateMessage message = CreateMessage();

  switch (dataSource.sourceType) {
    case DataSourceType.asset:
      message.asset = dataSource.asset;
      message.packageName = dataSource.package;
      break;
    case DataSourceType.network:
      message.uri = dataSource.uri;
      message.formatHint = _videoFormatStringMap[dataSource.formatHint];
      message.httpHeaders = dataSource.httpHeaders;
      break;
    case DataSourceType.file:
      message.uri = dataSource.uri;
      break;
    case DataSourceType.contentUri:
      message.uri = dataSource.uri;
      break;
  }

  TextureMessage response = await _api.create(message);
  return response.textureId;
}