0

Modify 'Random Play button' script / Add loop

Hello everyone,
I am on a Mac and using some of the scripts from your website.

At present I have a button connected to the GPIO port (and coming from a Arduino), to play your script 'Random Play button'.

How can I add a loop function so that when the button is pressed once, it plays one of the 20 video files and if nothing happens that video keeps playing on loop?

I tried grabbing the loop function from other scripts, but I keep seeing the error message on the BrightSign.

Many thanks for your help

MM

6 comments

  • 0
    Avatar
    ^UD\_$

    Please attach the script to your post so we can take a closer look.

  • 0
    Avatar
    Marcus Smith

    Hi Udi,

    Many thanks for your reply.

     

    Here is the script:

     

    debug=false
    P = createobject("roMessagePort")
    Vplayer = createobject("roVideoPlayer")
    Button = createobject("roGpioControlPort")
    Button.SetPort(p)
    Vplayer.SetPort(p)

    DIM vlist[20]
    vlist[0]="video1.mov”
    vlist[1]="video2.mov”
    vlist[2]="video3.mov”
    vlist[3]="video4.mov"
    vlist[4]="video5.mov"
    vlist[5]="video6.mov"
    vlist[6]="video7.mov"
    vlist[7]="video8.mov"
    vlist[8]="video9.mov"
    vlist[9]="video10.mov"
    vlist[10]="video11.mov"
    vlist[11]="video12.mov"
    vlist[12]="video13.mov"
    vlist[13]="video14.mov"
    vlist[14]="video15.mov"
    vlist[15]="video16.mov"
    vlist[16]="video17.mov"
    vlist[17]="video18.mov"
    vlist[18]="video19.mov"
    vlist[19]="video20.mov"

    button.EnableInput(0)
    not_currently_playing = true
    if debug print "Ready"

    Wait_to_play:
    Msg = wait(0,p)
    if debug print type(msg)

    if type(msg) = "roVideoEvent" and msg.GetInt() = 8 then
    vplayer.StopClear()
    not_currently_playing=true
    if debug print "Ready"
    else if type(msg) = "roGpioButton" then
    if debug print "Button: ";msg.GetInt()
    if msg.GetInt() = 0 then
    if not_currently_playing then
    tmpFile = rnd(20) - 1
    if debug print tmpFile; " = ";vlist[tmpFile]
    ok = vplayer.PlayFile(vlist[tmpFile])
    if ok = 0 then
    if debug print "error playing file"
    if debug print "Ready"
    goto wait_to_play
    else
    not_currently_playing=false
    endif
    endif
    endif
    endif

    goto wait_to_play

     

    At present I manage to have it playing when Arduino send a LOW voltage to one pin connected to button 0 from the GPIO being the Brightsign. However, when the video finsihes it goes back to 'wait_to_play'.

    Instead I am trying to have it playing in loop.

     

    Many thanks for your help

     

    MM

  • 0
    Avatar
    ^UD\_$

    The looping feature may not be available for the firmware version that you are using.

    (What is the model and firmware that you are using?)

     

    You could simply change the programing a little.

    Where your code responds to the video end event, you could simply start playing the same video again.

    The media end event is detected here:
    if type(msg) = "roVideoEvent" and msg.GetInt() = 8 then

     

    Or, depends on the model/firmware, you could upgrade to a firmware that supports looping, as described here:

    http://docs.brightsign.biz/display/DOC/roVideoPlayer#roVideoPlayer-SetLoopMode(modeAsDynamic)AsBooleansetloopmode

     

    I hope that helped.

     

  • 0
    Avatar
    Marcus Smith

    Yes thanks! I managed to add the set.Loop command and it works.
    But now I have to use a code written with BrightAuthor and the code I have taken from the Brightsign's scripts (see above) no longer works.
    I guess this is due to the fact that the HD230 seems to respond to a LOW digital input pin through the GPIO in order to thing it is a button.
    Can anyone confirm the player needs a LOW input in order to work?

    Many thanks

    MM 

  • 0
    Avatar
    ^UD\_$

    I'm assuming that you meant XD230.

    Here is the hardware info:
    http://docs.brightsign.biz/display/DOC/XDx30+Hardware+Interfaces

     

    Are you now trying to create the same functionality with BrightAuthor?

    If so, I'm assuming that you would use a Video List, and set it to Shuffle Playback.

    http://docs.brightsign.biz/display/DOC/Media+List%2C+Video+List%2C+Image+List%2C+Audio+List

     

    You could try and check your BrightAuthor programming with an event, other than GPIO, like a keyboard event.

    Once that works, try it with the GPIO event.

     

  • 0
    Avatar
    Marcus Smith

    Thank you!

    At the venue where we are projecting the movies, they use BrightAuthor to control three video beams.
    The technician here is programming it.
    And I am now looking of a way to interface the Arduino through the same GPIO event.
    I should read the GPIO signal like it was doing it before through the script, however we tried mouse down and mouse down events and it is not recognising the LOW signal, only the HIGH (and I don' have a real button I can swap :)
    Will have a look at the link you kindly sent through in a minute and see how his goes, will send updates later.

    Many thanks for all your help.
    Best.

    MM

Please sign in to leave a comment.