create method

  1. @override
Future<int?> create({
  1. PipFlutterPlayerBufferingConfiguration? bufferingConfiguration,
})
override

Creates an instance of a video player and returns its textureId.

Implementation

@override
Future<int?> create({
  PipFlutterPlayerBufferingConfiguration? bufferingConfiguration,
}) async {
  late final Map<String, dynamic>? response;
  if (bufferingConfiguration == null) {
    response = await _channel.invokeMapMethod<String, dynamic>('create');
  } else {
    final responseLinkedHashMap = await _channel.invokeMethod<Map?>(
      'create',
      <String, dynamic>{
        'minBufferMs': bufferingConfiguration.minBufferMs,
        'maxBufferMs': bufferingConfiguration.maxBufferMs,
        'bufferForPlaybackMs': bufferingConfiguration.bufferForPlaybackMs,
        'bufferForPlaybackAfterRebufferMs':
            bufferingConfiguration.bufferForPlaybackAfterRebufferMs,
      },
    );

    response = responseLinkedHashMap != null
        ? Map<String, dynamic>.from(responseLinkedHashMap)
        : null;
  }
  return response?['textureId'] as int?;
}