通过使用 flutters video_player 插件,我注意到一些链接在 iOS 设备上不起作用,但是如果我使用下面的示例链接,它甚至在 android 和 iOS 上也适用于所有设备。
https://sfux-ext.sfux.info/hls/chapter/105/1588724110/1588724110.m3u8
以下链接不适用于 iOS 设备,但适用于 android 设备,
https://5421175365ea3.streamlock.net/live/smil:switch.smil/playlist.m3u8
https://dcunilive28-lh.akamaihd.net/i/dclive_1@533583/master.m3u8
有什么线索可以让它发挥作用吗?
答案 0 :(得分:1)
如果您使用的是 video_player,您应该为 ios 注释以下代码
// The player may be initialized but still needs to determine the duration.
if ([self duration] == 0) {
return;
}
在第 315 行
YOUR_SDK_FOLDER\flutter\.pub-cache\hosted\pub.dartlang.org\video_player-your_player_version_no\Classes\FLTVideoPlayerPlugin.m
似乎实时 hls 流总是返回 duration=0
答案 1 :(得分:0)
您的 HLS 播放列表很烂,有很多问题,最大的问题是缺少编解码器信息。
使用 Apples HTTP Livestreaming 工具验证您的播放列表。
摘录您的第一个链接:
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
所有这些问题都会阻止 HLS 在 Apple 设备上播放,Android 可能会更宽容一些。