[英]Flutter HLS (m3u8) format video from asset not playing on the iOS device
[英]Flutter HLS .m3u8 video not playing in real time
我有一個 .m3u8 視頻 URL,在瀏覽器播放器上播放時效果很好,並持續顯示實時視頻。
但是用Flutter上的video_player,初始化視頻controller后,播放器只有20秒左右的可用時間,播放到最后就不再繼續播放了,就好像是20秒的限制一樣停止播放視頻。
如果我想看到接下來的幾秒或更接近實時提要,我需要處理並重新初始化 controller。
我沒有在任何地方看到這個問題,所以我哪里出錯了?
videoPlayerController = VideoPlayerController.network('https://example.com/abcdef.m3u8');
(videoPlayerController.value.isInitialized)
?
Expanded(
child: VideoPlayer(
videoPlayerController,
),
)
: Text('Nope'),
SizedBox(
height: screenHeight * 0.1,
),
SizedBox(
width: screenHeight * 0.2,
child: FloatingActionButton(
heroTag: 'Start',
onPressed: () async {
await videoPlayerController.initialize();
videoPlayerController.play();
home.notifyListeners();
},
child: const Text('Start'),
),
),
我找到了我一直遇到這個問題的原因。
在我的測試中,我還通過相機插件設置了 RTMP 流式傳輸,並且在我嘗試獲取 HLS 視頻時啟用了它。 我認為兩者是無關的,所以它不應該影響任何東西,但也許它們都使用同一個庫,所以這就是問題所在。 在沒有進行流式傳輸的情況下,HLS 視頻會按預期正常播放。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.