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: 
ishish
Visitor

control = "skipcontent" skips video, but it pauses

I have a playlist that I've set up on my video node. Things are working as expected when one video ends, the next begins with no issues. However when I set the control field on the Video Node to "skipcontent" the next video does not immediately start, I have to manually press the play button on the remote control to resume playback. Sample code:

sub startVideoPlayback()
  m.video = m.top.findNode("mainVideo")
  m.video.setFocus(true)

  ' playlist contents a ContentNode with child ContentNodes with the appropriate Content Meta-data
  m.video.content = playlist

  ' Allows us to control the trick play bar visibility. Even the default behavior (not mucking with the trickplaybar results in the same behavior)
    m.video.trickplaybarvisibilityauto=FALSE 
    m.video.trickplaybar.translation=[110,900]
    
   m.video.observeField("contentIndex", "contentIndexChanged")
    m.video.observeField("state", "videoStateChanged")
    m.video.control = "play"

end sub


function onKeyEvent(key as String, press as Boolean) as Boolean
    handled = false
    if key = "right" then
        ? "setting m.video.control skipcontent"
        m.video.control = "skipcontent" 
        handled = true
    end if
    return handled
end function

sub contentIndexChanged()
    ? "contentIndex: ", m.video.contentIndex, "[contentIndexChanged]"
    if m.video.state = "paused" 
        '? "resuming video [contentIndexChanged]"
      ' Have tried m.video.control = "play" here as well and that does not work
        m.video.control = "resume"
    end if 
end sub

sub videoStateChanged()
    ? "video state is ", m.video.state
end sub


This is what the print statements spit out either:

video state is  paused
onKeyEvent [PlayerScreen] called with key       right            press:         false
setting m.video.control skipcontent
video state is  buffering
video state is  buffering
contentIndex:    1              [contentIndexChanged]
contentIndex:    1              [contentIndexChanged]
video state is  playing
video state is  playing
video state is  paused
video state is  paused


Or sometimes the contentIndexChanged is not fired

video state is  paused
video state is  paused
onKeyEvent [PlayerScreen] called with key       right            press:         false
setting m.video.control skipcontent
video state is  buffering
video state is  buffering


in either case the behavior is the same. The next video will only play if the user physically presses play on the remote.

I've tried the following, nothing works :

  • in videoStateChanged I've tried setting m.video.control = "play" or m.video.control = "resume" when I'm in a buffering/paused state

  • in contentIndexChanged I've tried the same (trying to force play or resume)
0 Kudos
4 REPLIES 4
sparkerman
Visitor

Re: control = "skipcontent" skips video, but it pauses

what does your playlist look like?
0 Kudos
ishish
Visitor

Re: control = "skipcontent" skips video, but it pauses

I've found a workaround for the current Firmware in case others need it: 
1. Extend the video scenegraph component and put the onkeyEvent on that extended component 
2. Check for press=true right and left events and then set the m.top.nextContentIndex value and m.top.control="skipcontent" 
3. Make sure to return handled=true when you do this so it doesn't pass the event up the event chain

This seems to work. There seems to be a bug though when setting the nextContentIndex to a previous video in the playlist you have to set m.top.control = "play" not m.top.control="skipcontent".  When setting nextContentIndex to a playlist >= current contentIndex m.top.control="skipcontent" works.
0 Kudos
ishish
Visitor

Re: control = "skipcontent" skips video, but it pauses

"sparkerman" wrote:
what does your playlist look like?

Nothing special about it just a list of contentNodes with the appropriate fields to play a video. see my solution.
0 Kudos
RokuNB
Roku Guru

Re: control = "skipcontent" skips video, but it pauses

"ishish" wrote:
I've found a workaround for the current Firmware in case others need it: 
1. Extend the video scenegraph component and put the onkeyEvent on that extended component 
2. Check for press=true right and left events and then set the m.top.nextContentIndex value and m.top.control="skipcontent" 
3. Make sure to return handled=true when you do this so it doesn't pass the event up the event chain

Yes, there was issue in your code where your focus was not set or handled correctly so i figure the event kept bubbling up and affecting the video play - in particular Left/Right buttons pushing Video node into trick play. (I had a quick glance at your code)

This seems to work. There seems to be a bug though when setting the nextContentIndex to a previous video in the playlist you have to set m.top.control = "play" not m.top.control="skipcontent".  When setting nextContentIndex to a playlist >= current contentIndex m.top.control="skipcontent" works.

I am not convinced that "skipcontent" should be working the way you expect it to, esp. traveling back in the list
0 Kudos