0

A script for play video if button pressed



If somebody search something like this:) This script displayes picture.jpg as a screen saver till somebody press a button. if it pressed than it plays video.mpg. after playing it displays the picture again debug=true P = createobject("roMessagePort") pic = createobject("roImagePlayer") Vplayer = createobject("roVideoPlayer") gpio = CreateObject("roGpioControlPort") gpio.SetPort(p) Vplayer.SetPort(p) REM we enable the input on port 3 gpio.EnableInput(3) not_currently_playing = true if debug print "waiting for input" screensaver: pic.DisplayFile("picture.jpg") REM we wait to play the movie wait_to_play: Msg = wait(0,p) if debug print type(msg) REM test if the video plays yet REM if not and the gpio is on than play it if type(msg) = "roVideoEvent" and msg.GetInt() = 8 then Vplayer.StopClear() not_currently_playing = true goto screensaver if debug print "media ended waiting for new input" else if type(msg) = "roGpioButton" then if debug print "Button: ";msg.GetInt() if msg.GetInt() = 3 then if not_currently_playing then ok = Vplayer.PlayFile("movie.mpg") if ok = 0 then if debug print "error playing file" if debug print "Ready" goto screensaver else not_currently_playing=false endif endif endif endif goto wait_to_play <!-- s:idea: --><img src="{SMILIES_PATH}/icon_idea.gif" alt=":idea:" title="Idea" /><!-- s:idea: -->

0 comments

Please sign in to leave a comment.