playOrPause method

Future<bool> playOrPause()

Play or pause; that is, pause if currently playing, otherwise play

⚠️ Must be preloaded

return Returns the current playback status

Implementation

Future<bool> playOrPause() async {
  if (_preprocessing().isNotEmpty) return false;

  if (_initialize == false && _playing == false) {
    await play(index: _curIndex, auto: true);
    return true;
  } else {
    bool playing = await _channel.invokeMethod("playOrPause");
    _setPlaying(playing);
    return playing;
  }
}