createVideoView static method

Future<Map<String, dynamic>?> createVideoView({
  1. required String videoId,
  2. required String videoUrl,
  3. required int width,
  4. required int height,
})

Creates a video view on the native side.

videoUrl - The URL of the video to load width - Width of the video container in dp height - Height of the video container in dp

Returns a Map with videoId and success status

Implementation

static Future<Map<String, dynamic>?> createVideoView({
  required String videoId,
  required String videoUrl,
  required int width,
  required int height,
}) async {
  try {
    final result = await MethodHandler.invokeNativeMethod(
      'createVideoView',
      arguments: {
        'videoId': videoId,
        'videoUrl': videoUrl,
        'width': width,
        'height': height,
      },
    );

    if (result is Map) {
      return Map<String, dynamic>.from(result);
    }
    return null;
  } catch (e) {
    debugPrint('Error creating video view: $e');
    return null;
  }
}