Roku Developer Program

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

Start live channel with timeshift at live position

Jump to solution

Hello,

I've not found any documentation nor trick to proper start streaming a Dash video with timeshift at its live position.
Currently I observe stream duration then seek to that duration for this but it causes an unwanted audio video glitch.

Any help please?

Sample code:

sub init()
  videocontent = createObject("RoSGNode", "ContentNode")

  videocontent.live = true
  videocontent.title = "Live video with timeshift"
  videocontent.streamformat = "dash"
  videocontent.url = "https://host/live/channel_with_2h_timeshift.mpd"

  video = m.top.findNode("exampleVideo")
  video.ObserveField("duration", "onDuration")
  video.content = videocontent

  video.setFocus(true)
  video.control = "play"
end sub

sub onDuration(message as object)
  video = message.getRoSGNode()
  duration = video.duration
  if duration > 10 then
    video.UnobserveField("duration")
    video.seek = duration
  end if
end sub

 

0 Kudos
1 Solution

Accepted Solutions
RokuJonathanD
Roku Employee
Roku Employee

Re: Start live channel with timeshift at live position

Jump to solution

Hi @ojo1,

To start at the live edge, you can use the Video node's PlayStart field. In this case, you can do something like this: 

PlayStart(some large number) (for example, PlayStart(9999)

The media player will figure out that the live edge is wanted and will automatically set itself to 30 seconds behind it (this is the default setting for smooth buffering and no re-buffering events).

View solution in original post

0 Kudos
2 Replies
RokuJonathanD
Roku Employee
Roku Employee

Re: Start live channel with timeshift at live position

Jump to solution

Hi @ojo1,

To start at the live edge, you can use the Video node's PlayStart field. In this case, you can do something like this: 

PlayStart(some large number) (for example, PlayStart(9999)

The media player will figure out that the live edge is wanted and will automatically set itself to 30 seconds behind it (this is the default setting for smooth buffering and no re-buffering events).

View solution in original post

0 Kudos
ojo1
Level 7

Re: Start live channel with timeshift at live position

Jump to solution

Thanks you!

The documentation talks about negative value to allows "the media players to start playbacks distanced from the edge of the live stream". This is confusing...

Actually I found that solution after having accidentally put a bookmark position to a live stream!

Regards

0 Kudos