0

Transition on button press after media has ended



I have a scenario where a client would like to play a short looping video and when a button is pressed play a longer video, once that longer video is done go back to the short looping video. No problem right... but what they would like to have is that when a button is pressed the short looping video plays until it ends then the longer video plays. Is there a way to achieve this, I havent seen a way to do this through brightauthor? Is a custom script needed or external control system?

9 comments

  • 0
    Avatar
    RokuLyndon


    Yes, this needs a script.  Is this a gpio button? The following does what you describe assuming gpio button 0.



    v=createobject("roVideoPlayer")
    p=createobject("roMessagePort")
    g=createobject("roGpioControlPort")
    g.enableinput(0)

    g.setport(p)
    v.setport(p)

    mode=createobject("roVideoMode")
    mode.SetMode("1280x720x60p")

    avideo$="attract.mov"
    bvideo$="video.mov"

    aplaying=true
    bpressed=false

    start:
    v.playfile(avideo$)
    aplaying=true

    listen:
    msg = p.GetMessage()
    if type(msg) = "roVideoEvent" then
    if msg.getint() = 8 then

    if aplaying and bpressed then
    v.playfile(bvideo$)
    bpressed=false
    aplaying=false
    else
    goto start
    endif

    endif

    else if type(msg) = "roGpioButton" then
    if msg.getint() =0 then bpressed=true

    endif

    goto listen

  • 0
    Avatar
    pro2040


    Thanks for the info.  We would likely be using the 11 button pad or udp input from and external control system.  What would happen is that each button would start a different video.
  • 0
    Avatar
    pro2040


    This may be a silly question but, does this script go in the autorun.brs? If so where?
  • 0
    Avatar
    RokuLyndon


    This script should be saved as autorun.brs. It's the only thing that should be in the file. I'll need to update it if you want udp control instead of gpio which is what I set it up as.
  • 0
    Avatar
    pro2040


    Thanks again,
    I have tried using that code as my autorun.brs but when I try to select it as a custom autorun in BrightAughor I recieve an error.
  • 0
    Avatar
    RokuLyndon


    It's not a brightauthor script. It's a stand alone one. You just put this script and your content on a flash card. It's not mean to be used with brightauthor.
  • 0
    Avatar
    Lyndon

    This can now be done using brightauthor 3.8, without a custom script. 

  • 0
    Avatar
    Kh

    Hi Sr. Support America

    Can you tell me how this function can be done with Brightauthor now without a script?

  • 0
    Avatar
    Brandon
    1. In File>Presentation Properties, Variables tab
      Create a PlayToEnd user variable in BrightAuthor, default value 0
      This variable will keep track of whether the button has been pressed.
    2. On the short video, add a command for
      Other>Reset Variable>PlayToEnd
      This will ensure we don't inherit a button press.
    3. Add your "play to end" button press event to the short video
      Have it Remain on current state
      and add a command for
      Other>Set Variable>PlayToEnd 1
      This will set the PlayToEnd variable to 1 when we receive the button press, but let the short video continue playing.
    4. On the Media End event for the short video
      Click Conditional Targets
      Add a conditional target for
      If PlayToEnd Greater than or equal to 1 (equals will also work here, but it's good practice to cover edge/overflow cases) (then) Transition to the long video

    If you have trouble, add a new Image Zone and put a Live Text state in it to display the value of user variable PlayToEnd - that will debugging.

Please sign in to leave a comment.