Forum Discussion

CoryM's avatar
CoryM
Visitor
15 years ago

roVideoScreen + roAudioPlayer

It seems that if I have an roAudioPlayer playing or paused if I try to Show() a roVideoScreen it sends a isScreenClosed() event immediately.

Is this intentional? Is there a way around it?

I don't really need the audio playing along with the video. I would be fine with pausing it and resuming it once the video is complete.

7 Replies

  • jbrave's avatar
    jbrave
    Channel Surfer
    If you use a global for the audio player like:


    m.audioplayer=createobject("roaudioplayer")



    Then the audioplayer should continue to exist no matter what else you do. (except assign it to something else) You can also pass a non-global audioplayer to the video routine:

    audioplayer=createobject("roaudioplayer")

    audioplayer=playvideo(content,audioplayer)

    function playvideo(content as object, audioplayer as object) as object

    ...
    return audioplayer
    end function
  • I'm sorry, that wasn't what I was asking.


    a=createobject("roaudioplayer")
    v=createobject("rovideoscreen")

    'Setup the Content Metadata......

    a.Play()

    port = CreateObject("roMessagePort")
    v.SetMessagePort(port)
    v.Show()

    while true
    msg = wait(0, port)
    if type(msg) = "roVideoScreenEvent" then
    if msg.isScreenClosed()
    print "This gets called right away, the video never plays"

  • In your example, you didn't setup any content-meta data for the roVideoScreen to play...

    Nonetheless, you can't play audio and video simultaneously. There is no mixing of the audio.

    --Kevin
  • 'Setup the Content Metadata......

    was just suppose to be a placeholder 🙂 That is all of the code talking to our service. Anyway....

    If I Pause() the AudioPlayer, it still doesn't work. The AudioPlayer has to be Stopped or the VideoScreen will not launch.

    Is this the expected behavior?

    I'm not looking to mix the audio. I just want an mp3 to be playing, play a video, then continue playing the mp3 from where it left off.
  • "CoryM" wrote:
    I just want an mp3 to be playing, play a video, then continue playing the mp3 from where it left off.


    I haven't tested it, but I'd recommend trying the following.

    1. When you create the roAudioPlayer, create an roTimespan as well.
    2. When you set the roAudioPlayer to play, call Mark() with the roTimeSpan.
    3. Just before starting the video, grab the total milliseconds from the roTimeSpan.
    4. After the video has finished playing, recreate your roAudioPlayer with the same Meta data and then use Seek to get back to where you left off.