stopPlayer method

  1. @override
void stopPlayer()
override

Stops the player and cancels the player state subscription.

Implementation

@override
void stopPlayer() async {
  try {
    await _methodChannel.invokeMethod("stopPlayer");

    // Cancel the player state subscription if it exists.
    playerStateSubscription?.cancel();
    playerStateSubscription = null;
  } catch (e) {
    throw Exception("Unable to stop the player [Stop Player]");
  }
}