Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
gomad
Level 7

Video node progressive download indicator

Hi,
I am using a video node and trying to make a custom UI for the player. I wanted to show a progress bar with current progress and downloaded (buffered) segments (if any). I have a DASH/HLS content. How do i achieve this? I am getting the current position by observing the "position" field but not sure how to calculate/get the buffered data position, anyone?

regards,
gm
0 Kudos
5 Replies
tim_beynart
Level 7

Re: Video node progressive download indicator

m.videoplayer.observeFieldScoped("bufferingStatus", "onBufferChanged")

sub onBufferChanged()
' log percentage buffered
  status = m.videoplayer.bufferingStatus
  ?  status.percentage
end sub

https://sdkdocs.roku.com/display/sdkdoc ... playFields
0 Kudos
gomad
Level 7

Re: Video node progressive download indicator

thanks, but this was not what i was looking for, i was thinking of something that is "pre-bufferred" or pre-dowloaded while playback is going on. 
So for e.g , the progress bar would look something like this : 
=======|____ 
where "===" is the actual progress of the video, "|" is the current position of playback and "____" is the pre-buffered stream content.
Hope this makes sense. This is seen in youtube, i am not sure how to implement in SG.
0 Kudos
24i
Level 7

Re: Video node progressive download indicator

Hi gomad,

We haven't done this before, but I do know that there are read-only fields like "streamingSegment" and "streamingSegment" on the video node. Maybe that helps?
Source: https://sdkdocs.roku.com/display/sdkdoc/Video
0 Kudos
gomad
Level 7

Re: Video node progressive download indicator

I tried using those, these were giving increments based on streams segment values. It would have helped if i got the total segments in the stream at start of the playing itself, i could not find any fields that gave those. Its need to calculate the increment for drawing the progress.
0 Kudos
tim_beynart
Level 7

Re: Video node progressive download indicator

Off the top of my head:
You can download the HLS manifest as a text file in parallel with the player. Parse it and perform calculations to figure out how many segments there are, and how long each one is.
Then you can use the "downloadedSegment" field to track which segments are in the buffer, and use the "streamingSegment" field to determine where the playhead is in the playlist.
0 Kudos