open method

Future<void> open(
  1. Playable playable, {
  2. bool play = true,
})

Opens a Media or Playlist into the Player. Passing play as true starts the playback immediately.

await player.open(Media('asset:///assets/videos/sample.mp4'));
await player.open(Media('file:///C:/Users/Hitesh/Music/Sample.mp3'));
await player.open(
  Playlist(
    [
      Media('file:///C:/Users/Hitesh/Music/Sample.mp3'),
      Media('file:///C:/Users/Hitesh/Video/Sample.mkv'),
      Media('https://www.example.com/sample.mp4'),
      Media('rtsp://www.example.com/live'),
    ],
  ),
  play: true,
);

Implementation

Future<void> open(
  Playable playable, {
  bool play = true,
}) async {
  return platform?.open(
    playable,
    play: play,
  );
}