Forum Discussion

Transparent's avatar
10 years ago

roUniversalControlEvent - Pause/Play functions

Hi, I'm trying to implement the ability to Play and Pause my video when sent by ECP. I got the following code from customvideoplayer.

**How can I implement my video app to allow it to Play/Pause upon receiving a command through ECP (Posting /Keypress/Play) - When I try to it says code 13/code 113 in the debugger
I've code below that I'm trying to play with to get it to work but I'm not sure if I'm heading with the right approach.

Screenshot: Send video url and it plays fine
http://imgur.com/a/PcQ0v

Screenshot: Command I'm sending to try to Pause the video
http://imgur.com/a/DyPBB

Screenshot: What I'm getting back from debugger when I try to send Pause/Unpause(play) command
http://imgur.com/a/z00IC

msg = wait(0, m.port)
if msg <> invalid
'If this is a startup progress status message, record progress
'and update the UI accordingly:
if msg.isStatusMessage() and msg.GetMessage() = "startup progress"
m.paused = false
progress% = msg.GetIndex() / 10
if m.progress <> progress%
m.progress = progress%
end if

'Playback progress (in seconds):
else if msg.isPlaybackPosition()
m.position = msg.GetIndex()

else if msg.isRemoteKeyPressed()
index = msg.GetIndex()
print "Remote button pressed: " + index.tostr()

if index = 4 or index = 8 '<LEFT> or <REV>
m.position = m.position - 60
m.player.Seek(m.position * 1000)
else if index = 5 or index = 9 '<RIGHT> or <FWD>
m.position = m.position + 60
m.player.Seek(m.position * 1000)
else if index = 13 '<PAUSE/PLAY>
if m.player.paused m.player.Resume() else m.player.Pause()
end if

else if msg.isPaused()
this.paused = true


else if msg.isResumed()
this.paused = false


end if
'Output events for debug
print msg.GetType(); ","; msg.GetIndex(); ": "; msg.GetMessage()
if msg.GetInfo() <> invalid print msg.GetInfo();
end if
end while



Or is this the right way to do it -
  'event = port.GetMessage()
' if (event <> invalid)
' if (type(event) = "roUniversalControlEvent")
' code = event.GetInt()
' print "code: " + stri(code)
' if code = 13
'if player.paused player.Resume() else player.Pause()
' end if

' else if msg.isPaused()
' this.paused = true

' else if msg.isResumed()
' this.paused = false

' endif
' endif

20 Replies