0

Run brightscript on UDP input

Hello,
I have been looking for a solution for when a video is playing and a user pushes a button on an external device that sends a UDP string to the player will jump the current playing video back by 30 seconds for example.

I have had a look at the documentation and I have written the following - i could be way off the mark with this however.
The idea is that the trigger reads current position, then sets it back by 30 seconds.
I am however unsure first if this script is correct and then secondly, how to link a UDP message input to trigger a custom script

videoPlayer = CreateObject("roVideoPlayer")

   

' Assuming the video is already playing

' Get the current position of the video

currentPosition = videoPlayer.GetPlaybackPosition()

' Calculate the new position, 30 seconds earlier

newPosition= currentPosition-30000

' BrightScript measures time in milliseconds

' Ensure the new position is not negative

    if newPosition < 0 then

        newPosition = 0

    end if

' Seek to the new position

    videoPlayer.Seek(newPosition)

' Call the function to rewind the video

4 comments

Please sign in to leave a comment.