I'm trying to play HLS video in flutter video_player. I'm generating m3u8 file like this:
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1609034710
#EXT-X-PLAYLIST-TYPE:EVENT
#EXTINF:10.0,
video_part1.ts
#EXTINF:10.0,
video_part2.ts
#EXTINF:10.0,
video_part3.ts
#EXTINF:10.0,
video_part4.ts
#EXTINF:10.0,
video_part5.ts
... // etc.
I do not change or delete old parts, only append new ones when they available.
Video plays normally, but when I check controller.value.duration
it always shows 50 seconds - the duration of the first playlist before any updates, and it does not allow me to seekTo
beyond that position.
I can count real duration from playlist, but question is: How can I put that duration into a player and seek to any position in it?
After some research:
controller.value
, so you probably just need update duration somewhere there. I decided to give it a try later then, but not now.controller.value.isBuffering
is always false
), but at the moment it's in beta and requires beta flutter and dart sdk with the null safety feature. It won't be a problem in the future when all the code migrates to null safety, but now it requires to update lots of my code in the project, and does not guarantie that the problem will be solved, so I did not use it.Ended up using flutter_playout for this task. It's NOT based on default video_player and does not have this bug (but probably has others, need to use it more), and it works!