play method

Future<bool> play()

Plays the video.

Implementation

Future<bool> play() async {
  if (_isDisposed) {
    debugPrint('Cannot play: Video renderer is disposed');
    return false;
  }

  try {
    final result = await MethodHandler.invokeNativeMethod(
      'playVideo',
      arguments: {'videoId': videoId},
    );

    if (result is Map) {
      return result['success'] == true;
    }
    return false;
  } catch (e) {
    debugPrint('Error playing video: $e');
    return false;
  }
}