Replies: 1 comment 2 replies
-
Add You must decide what threshold of seekable range is needed for you to allow seeking (DVR). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm developing a custom video player for my needs, using pure JS and the HLS.js library. Stuck on developing the progress bar when a live video is playing in the player (live stream)
Introduction
An example with two video players from Flowplayer is available at this link to CodePen.
Start playing the first video. Pay attention to the LIVE button, it's blue. Then, a little later, pause it. After some time it will turn gray. Clicking the button will take you to the live broadcast
Start playing the second video. Pay attention to the LIVE button, it is blue, and there is a progress bar (search bar). Hover over the search bar and it will show the time. Click anywhere in the search bar. The player will start playing a pre-recorded live broadcast (DVR) from the second you requested, that is, we seem to be going back a little into the past. The LIVE button will turn gray. Clicking the button will take you to the live broadcast. If you are watching a live stream in real time, the LIVE button will always be blue. But as soon as you pause the video, after a while it will turn gray again, just like in the first player
What I would like to understand
How does the player determine whether the live stream is with DVR or without DVR. This is needed for conditional markup. For example, if the stream is without DVR, then we do not show the progress bar, but if the stream is with DVR, then we show the progress bar (conditionally)
LIVE button. Why does it change color from blue to gray? What is this signal about? How long does it take for it to change color? What does clicking this button do? How to implement similar functionality using JS?
Progress bar (search bar) for stream from DVR. What does time mean when you hover over this panel? What function does clicking on the progress bar perform (“what does this click do”)
Research
Having rummaged through the source codes, I noticed that all of them use an additional parameter, conventionally
"min_dr_size"
, which, according to the Flowplayer documentation, means "How many seconds of live content need to be buffered before dvr is enabled. Default: 60 seconds." (Source - https://docs.flowplayer.com/player/configuration, large page, search for "seconds_to_dvr")In many cases it is suggested to check
video.duration === Infinity
, but this does not give anything. In the case of playback, whether Live or VOD,video.duration
will always return something, but notInfinity
, this is no longer an option. But since I use HLS.js, by analyzing the manifest levels we can understand whether it is VOD or Live, for example, when parsing the manifest (Hls.Events.MANIFEST_PARSED
event (source)), parse the first level. The details object has alive: true / false
parameter, but even if we determine thatlive:true
, this does not provide information about whether this live stream is with or without DVR.JW player also has similar functionality. You can play around here - https://developer-tools.jwplayer.com/stream-tester, the source URL is on the demo page
In general, my findings did not give me anything, there are a lot of open questions left, I would be glad for any help or ideas
Beta Was this translation helpful? Give feedback.
All reactions