Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gomad
Roku Guru

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
6 REPLIES 6
tim_beynart
Channel Surfer

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
Roku Guru

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
Streaming Star

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
Roku Guru

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
Channel Surfer

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
chaklasiyanikun
Roku Guru

Re: Video node progressive download indicator


@tim_beynart wrote:
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

I did this trick which is @tim_beynart  said for display a video buffering percentage. But, when 100% of buffering is done, status.percentage line APK was crashed. Does anyone know why crashed here and any solution for this?
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.