play method

Future<void> play()

Play video

Implementation

Future<void> play() async {
  if (_videoController == null) {
    throw Exception('Video not initialized');
  }

  if (_state == PlaybackState.error) {
    throw Exception(_errorMessage ?? 'Video player error');
  }

  try {
    await _videoController!.play();
    _setState(PlaybackState.playing);
  } catch (e) {
    _setState(PlaybackState.error);
    _errorMessage = 'Failed to play video: ${e.toString()}';
    notifyListeners();
    rethrow;
  }
}