1

我注意到使用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

任何线索我们怎样才能使它工作?

4

2 回答 2

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

于 2021-06-20T15:10:42.970 回答
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 可能会更宽松一些。

于 2021-06-19T21:38:42.490 回答