Developers

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
Tags (1)
0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!