0

HD 410 & multiple files



Hi All, I would like to play two separate files, one audio and one video with one contact closure on one HD 410. I am using the BrightAuthor software. Or, the video file playing all the time and introduce the audio while maintaining the video. Any ideas?

16 comments

  • 0
    Avatar
    RokuLyndon


    You can't do this with brightauthor, but need to do it with a script. This example listens for button 1, and plays a video and audio when the button is pressed. When the video ends, it waits again.


    v = createobject("roVideoPlayer")
    a = createobject("roAudioPlayer")
    p = createobject("roMessagePort")
    gpio = createobject("roGpioControlPort")

    gpio.SetPort(p)
    v.SetPort(p)
    gpio.EnableInput(1)

    v.SetAudioOutput(2) 'hdmi
    a.SetAudioOutput(0) 'analog

    wait_for_input:
    msg=wait(0,p)

    if type(msg) = "roGpioButton" then

    REM Plays both files if gpio 1 is pressed
    if msg.GetInt() = 1 then
    v.PlayFile("video1.mpg")
    a.PlayFile("audio1.mp3")

    endif


    else if type(msg) = "roVideoEvent" then

    if msg.GetInt() = 8 then  'video playback has ended
    goto wait_for_input

    endif

    endif
    goto wait_for_input


  • 0
    Avatar
    Alginal


    looks good, but the idea is to introduce the audio while the video is playing.
  • 0
    Avatar
    RokuLyndon


    Is the video longer than the audio? Is it possible the audio will stop and the video will still be playing, so both then need to be restarted? If the video ends, and the audio is still playing, should we not restart the video?


       v = createobject("roVideoPlayer")
       a = createobject("roAudioPlayer")
       p = createobject("roMessagePort")
       gpio = createobject("roGpioControlPort")

       gpio.SetPort(p)
       v.SetPort(p)
       a.SetPort(p)
       gpio.EnableInput(1)

       v.SetAudioOutput(2) 'hdmi
       a.SetAudioOutput(0) 'analog
      audio_off = true

       Start:
       v.PlayFile("video1.mpg")

       wait_for_input:
       msg=wait(0,p)

       if type(msg) = "roGpioButton" then

       REM Plays both files if gpio 1 is pressed
       if msg.GetInt() = 1 then
       a.PlayFile("audio1.mp3")
       audio_off = false

       endif


       else if type(msg) = "roVideoEvent" and audio_off then

       if msg.GetInt() = 8 then  'video playback has ended
       goto Start

       endif

       else if type(msg) = "roAudioEvent" then

       if msg.GetInt() = 8 then audio_off=true
       endif
       goto wait_for_input


  • 0
    Avatar
    Alginal


    the video is an attract video, it plays all the time until a button is pushed to play the main video.  The audio is introduced during the attract as ambient sound and is stopped when the same button for the main video is pushed.
  • 0
    Avatar
    Alginal


    sorry, the audio is longer, 30 min and the video is 5min
  • 0
    Avatar
    RokuLyndon


    Ok, so If I push the button to star the audio, what should happen if the audio ends, or the video ends before the button is pushed to start the second video.
  • 0
    Avatar
    Alginal


    the attract video is always on,  the audio times out and wait for another signal to start
  • 0
    Avatar
    RokuLyndon


    Here you go. This accepts motion on gpio 1, and a button on gpio2.



           v = createobject("roVideoPlayer")
           a = createobject("roAudioPlayer")
           p = createobject("roMessagePort")
           gpio = createobject("roGpioControlPort")

           gpio.SetPort(p)
           v.SetPort(p)
           a.SetPort(p)
           gpio.EnableInput(1)
           gpio.EnableInput(2)

           v.SetAudioOutput(2) 'hdmi
           a.SetAudioOutput(0) 'analog
    a.SetLoopMode(0) 'play audio once
    mainvideo_notplaying=true

           Start:
           v.PlayFile("attract.mpg")


           wait_for_input:
           msg=wait(0,p)

           if type(msg) = "roGpioButton" then

    REM Plays both files if gpio 1 is pressed

    if msg.GetInt() = 1 and mainvideo_notplaying then
    a.PlayFile("audio1.mp3")
    else if msg.GetInt() = 2 then
    a.Stop()
    v.PlayFile("mainvideo.mpg")
    mainvideo_notplaying=false
    endif


           else if type(msg) = "roVideoEvent" then
    if msg.GetInt() = 8 then  'video playback has ended
    a.Stop()
    mainvideo_notplaying=true
    goto Start
    endif



           endif
           goto wait_for_input



  • 0
    Avatar
    Alginal


    Thanks, this is my edited version of your file.  I am unable to make it work.  Do you recommend a TXT file or CVS file.  



            v = createobject("roVideoPlayer")
            a = createobject("roAudioPlayer")
            p = createobject("roMessagePort")
            gpio = createobject("roGpioControlPort")

            gpio.SetPort(p)
            v.SetPort(p)
            a.SetPort(p)
            gpio.EnableInput(0)
            gpio.EnableInput(1)

            v.SetAudioOutput(2) 'hdmi
            a.SetAudioOutput(0) 'analog
          a.SetLoopMode(0)   'play audio once
          left_notplaying=true

            Start:
            v.PlayFile("loopleft.ts")


            wait_for_input:
            msg=wait(0,p)

            if type(msg) = "roGpioButton" then

             REM Plays both files if gpio 1 is pressed

             if msg.GetInt() = 1 and left_notplaying then
                a.PlayFile("audio1.mp3")
             else if msg.GetInt() = 2 then
                a.Stop()
                v.PlayFile("left.mpg")
                left_notplaying=false
             endif


            else if type(msg) = "roVideoEvent" then
             if msg.GetInt() = 8 then  'video playback has ended
                a.Stop()
                left_notplaying=true
                goto Start
             endif
             


            endif
            goto wait_for_input
  • 0
    Avatar
    RokuLyndon


    You are using gpios 1 and 2, but the two gpios we enabled fo rinput was 0 and 1. So, make this change:

           gpio.EnableInput(1)
           gpio.EnableInput(2)

  • 0
    Avatar
    Alginal


    Hi, I copied your file exactly, saved as txt and changed my file names to match the ones in the txt file.  Still nothing.  After a while the unit start playing the files one after another.

    thx
  • 0
    Avatar
    RokuLyndon


    You should be saving the file as autorun.brs. That's that the script file has to be called.
  • 0
    Avatar
    Alginal


    I downloaded a .brs file from this forum and did the same.
    Hi, I copied your file exactly, replaced the content of a autorun.brs file and changed my file names to match the ones in your file. Still nothing. The unit defaults to BrightSign logo and version number screen. <!-- s:evil: --><img src="{SMILIES_PATH}/icon_evil.gif" alt=":evil:" title="Evil or Very Mad" /><!-- s:evil: -->
  • 0
    Avatar
    RokuLyndon


    Can you send me a screenshot of contents of your flash card? And, send me the autorun that you have on the flash card.
  • 0
    Avatar
    Alginal


    I sent the files as requested, were you able to make it work?
  • 0
    Avatar
    RokuLyndon


    I haven't received any files. Can you send to <!-- e --><a href="mailto:support@brightsign.biz">support@brightsign.biz</a><!-- e -->?
Please sign in to leave a comment.