2

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?

wilz
  • 55
  • 1
  • 6

2 Answers2

2

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

Stupid Dream
  • 140
  • 1
  • 9
0

Your HLS playlist is pretty boken and has a lot of issues, biggest one would the missing codec information.

Use Apples HTTP Livestreaming tools to validate your playlist.

Excerpt for your first link:

Must Fix Issues
1. Measured peak bitrate compared to master playlist declared value exceeds error tolerance

    Master Playlist Stream Definition for All Variants

2. I-frame playlists ( EXT-X-I-FRAME-STREAM-INF ) MUST be provided to support scrubbing and scanning UI

    Master Playlist

3. Your EXT-X-STREAM-INF and EXT-X-I-FRAME-STREAM-INF tags MUST always provide CODECS attribute

    Master Playlist Stream Definition for All Variants

4. Your EXT-X-STREAM-INF and EXT-X-I-FRAME-STREAM-INF tags MUST always provide the RESOLUTION attribute if the rendition(s) include video

    Master Playlist Stream Definition for All Variants

5. You MUST include the AVERAGE-BANDWIDTH attribute

    Master Playlist Stream Definition for All Variants

6. Each EXT-X-STREAM-INF tag MUST have a FRAME-RATE attribute

    Master Playlist Stream Definition for All Variants

7. The server MUST deliver playlists using gzip content-encoding

    All Variants
    Master Playlist

8. The EXT-X-PROGRAM-DATE-TIME tag MUST be present in every live/linear media playlist

    All Variants

9. You MUST provide at least 6 segments in a live/linear playlist

    All Variants

10. If EXT-X-INDEPENDENT-SEGMENTS is not in master playlist, then you MUST use the EXT-X-INDEPENDENT-SEGMENTS tag in all video media playlists

    All Variants

All these issues can prevent HLS from playing on Apple devices, Android might be a bit more lenient.

ethergeist
  • 599
  • 4
  • 14
  • Both https://5421175365ea3.streamlock.net/live/smil:switch.smil/playlist.m3u8 https://dcunilive28-lh.akamaihd.net/i/dclive_1@533583/master.m3u8 links are works well on Mobiles safari browsers directly and swifts native AVplayer. How can we play above links using flutters video_player plugin ? it works well on flutters vlc player but vlc player doesn't provide any UI controls. and it freezes in between – wilz Jun 19 '21 at 21:50
  • They might play just fine in third party players and plattforms, but Apple is known to be very strict with what their devices accept as valid HLS. (Which is a good thing for their users, just to be clear.) And since on iOS the flutter video_player is backed by the native `AVPlayer` (ref: https://pub.dev/packages/video_player#supported-formats), i still think your problem is broken HLS. – ethergeist Jun 19 '21 at 21:58
  • I have tried all 3 links with AVPlayer, Native app it works well on apple devices without any issues. 2nd link https://5421175365ea3.streamlock.net/live/smil:switch.smil/playlist.m3u8 which is from wowza streaming service. I suspect video_player doesnt read this type of m3u8 syntax. there should be someway to extract it by using reg-expresion or something. – wilz Jun 19 '21 at 23:21