How to play m3u8 links using flutters video_player or chewie or video_viewer plugin?

Issue

I have noticed some of the links are not working on iOS devices by using flutters video_player plugin, but If I use the below example link, it works well on all the devices even on android and iOS.

https://sfux-ext.sfux.info/hls/chapter/105/1588724110/1588724110.m3u8

below links are not working on iOS devices but works on android devices,

https://5421175365ea3.streamlock.net/live/smil:switch.smil/playlist.m3u8

https://dcunilive28-lh.akamaihd.net/i/dclive_1@533583/master.m3u8

any clue how can we make it work?

Solution

If you’re using video_player you should comment the below code for ios

// The player may be initialized but still needs to determine the duration.
if ([self duration] == 0) {
  return;
}

In line number 315

YOUR_SDK_FOLDER\flutter\.pub-cache\hosted\pub.dartlang.org\video_player-your_player_version_no\Classes\FLTVideoPlayerPlugin.m

It seems like live hls stream is always returning duration=0

Answered By – Stupid Dream

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.