Is it possible to trigger http call when every video in a non interactive presentation is played? I want to have a custom script that will call different http end points based on the video file name from the presentation. The idea is a scheduler will schedule video content and publish it the player and the script will make different http call every time any video file starts playing based on the playback file name.
Date
Votes
1 comment
-
Ken C Yes, you can use the roUrlTransfer object to make an HTTP GET or POST every time one of your videos starts. Look for roVideoEvent with a value of 3 then make the request. You can set / get user data to pass the URL or part of the URL to the event handler.
Below is a standalone autorun.brs to try out. I haven't tested this, and you'll need to modify it to suit your environment, but it should give you a starting point to experiment with.
Sub Main
BASEURL = "https://my.server.com/script.php?video="
FILENAME = "video1.mov"
messagePort = CreateObject("roMessagePort")
videoPlayer = CreateObject("roVideoPlayer")
videoPlayer.SetPort(messagePort)
videoPlayer.SetUserData(BASEURL + FILENAME)
videoPlayer.PlayFile(FILENAME)
while true
event = Wait(0, messagePort)
if type(event) = "roVideoEvent" then
if event.GetInt() = 3 then
url = event.GetUserData()
httpRequest = CreateObject("roUrlTransfer")
httpRequest.SetURL(url)
httpRequest.AsyncGetToString()
end if
else if type(event) = "roUrlEvent" then
'Optionally handle any response from async httpRequest
end if
end while
End Sub
Please sign in to leave a comment.