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

Disable Trick Play

Hello, I have this code that will play my Pre-roll read from an xml file, then play the show after that. I want to disable trick play for the pre-roll part only.
what would I change below to disable trick play for pre-roll and keep trick play for the regular show? I use the videoplayer code and this is from videoscreen.brs

Function showVideoScreen(episode As Object)

If Type(episode)<>"roAssociativeArray"
Print"invalid data passed to showVideoScreen"
Return -1
End If

AdStatus=TRUE
'create another facade screen to prevent flicker
canvas=CreateObject("roImageCanvas")
canvas.SetLayer(0,{Color:"#FF000000",CompositionMode:"Source"})
canvas.Show() 'show the screen

If Episode.PrePlay1<>""

port=CreateObject("roMessagePort")
screen=CreateObject("roVideoScreen")
screen.SetMessagePort(port)
screen.SetPositionNotificationPeriod(30)

ContentToPlay=CreateObject("roAssociativeArray")
ContentToPlay.Title="Video will play after this message"
ContentToPlay.ContentType="movie"
ContentToPlay.StreamFormat="mp4"
ContentToPlay.ContentQuality="SD"
ContentToPlay.StreamQualities=[]
ContentToPlay.StreamBitrates=[]
ContentToPlay.StreamUrls=[]
ContentToPlay.StreamQualities.Push("SD")
ContentToPlay.StreamBitrates.Push(0)
ContentToPlay.StreamUrls.Push(episode.PrePlay1)
screen.SetContent(ContentToPlay)
screen.show()
While TRUE
msg=wait(0,port)
If Type(msg)="roVideoScreenEvent"
Print"showHomeScreen | msg = ";msg.getMessage();" | index = ";msg.GetIndex()
If msg.isScreenClosed()
Print"Screen closed"
Exit While
ElseIf msg.isRequestFailed()
Print"Video request failure: ";msg.GetIndex();" ";msg.GetData()
Exit While
' ElseIf msg.isPartialResult() 'user quit before video finished playing
' AdStatus=FALSE
ElseIf msg.isStatusMessage()
Print"Video status: ";msg.GetIndex();" ";msg.GetData()
ElseIf msg.isButtonPressed()
Print"Button pressed: ";msg.GetIndex();" ";msg.GetData()
Else
Print"Unexpected event type: ";msg.GetType()
End If
Else
Print"Unexpected message class: ";type(msg)
End If
End While
screen.close()
End If

If AdStatus=TRUE
port=CreateObject("roMessagePort")
screen=CreateObject("roVideoScreen")
screen.SetMessagePort(port)
screen.SetPositionNotificationPeriod(30)
screen.SetContent(episode)
screen.Show()

'Uncomment this line to dump the contents of the episode to be played
PrintAA(episode)

While True

msg = wait(0, port)

if type(msg) = "roVideoScreenEvent" then
print "showHomeScreen | msg = "; msg.getMessage() " | index = "; msg.GetIndex()
if msg.isfullresult()
print "Video Completed Playback Normally"
RegDelete(episode.ContentId)
print "deleted bookmark for playback position"
else if msg.isScreenClosed()
print "Screen closed"
exit while
elseif msg.isRequestFailed()
print "Video request failure: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isStatusMessage()
print "Video status: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
RegWrite(episode.ContentId, nowpos.toStr())
else
print "Unexpected event type: "; msg.GetType()
end if
else
print "Unexpected message class: "; type(msg)
end if
end while

End If

canvas.Close() 'ensure facade screen is destroyed

End Function
0 Kudos
3 REPLIES 3
destruk
Streaming Star

Re: Disable Trick Play

0 Kudos
bandal
Visitor

Re: Disable Trick Play

I tried all day to get this to work and no luck. My meta tag from xml is called preplay1 and all works with trick mode, but wanted to see if I could disable the preplay1 or pre roll. Any hints? I saw the Blog many times and tried to make it work, but...
DA
0 Kudos
destruk
Streaming Star

Re: Disable Trick Play

As long as you're using roVideoScreen, you can't disable trick play. You need to use roVideoPlayer with either an roImageCanvas or roScreen.
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.