muslimtv / flutter_playout

AV Playout in Flutter
BSD 3-Clause "New" or "Revised" License
152 stars 94 forks source link

Programmatic way of playing the hls stream (.m3u8) #74

Closed huxaiphaer closed 3 years ago

huxaiphaer commented 3 years ago

Is there a way (Programmatically ) of playing and stopping the stream ?

KhuramKhalid commented 3 years ago

For play/pause, the Video widget takes a desiredState parameter.

PlayerState _desiredState = PlayerState.PLAYING;

You will have to keep this in your stateful widget, pass it as parameter to the Video widget and change its value to play/pause stream. The widget can detect the change and will update the player accordingly. For example to pause stream see below.

setState(() {
  _desiredState = PlayerState.PAUSED;
});