requestPlay method

Future<void> requestPlay(
  1. OmniPlaybackController controller
)

Plays a video controller, pausing any previous one first.

Implementation

Future<void> requestPlay(OmniPlaybackController controller) async {
  await _lock.synchronized(() async {
    if (_currentVideoPlaying == controller) return;

    await _currentVideoPlaying?.pause(useGlobalController: false);

    if (_currentVolume > 0) {
      controller.unMute();
    } else if (_currentVolume == 0) {
      controller.mute();
    }
    await controller.play(useGlobalController: false);

    await WakelockPlus.enable();

    _currentVideoPlaying = controller;
    notifyListeners();
  });
}