Forum Discussion

gomad's avatar
gomad
Roku Guru
8 years ago

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

6 Replies

    • chaklasiyanikun's avatar
      chaklasiyanikun
      Roku Guru

      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?
  • 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.
  • 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.
  • 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.