Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
CoryM
Visitor

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.
0 Kudos
7 REPLIES 7
jbrave
Channel Surfer

Re: roVideoScreen + roAudioPlayer

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
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
CoryM
Visitor

Re: roVideoScreen + roAudioPlayer

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"

0 Kudos
RokuKevin
Visitor

Re: roVideoScreen + roAudioPlayer

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
0 Kudos
CoryM
Visitor

Re: roVideoScreen + roAudioPlayer

'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.
0 Kudos
RokuKevin
Visitor

Re: roVideoScreen + roAudioPlayer

That's expected behavior.

--Kevin
0 Kudos

Re: roVideoScreen + roAudioPlayer

"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.
0 Kudos
renojim
Community Streaming Expert

Re: roVideoScreen + roAudioPlayer

Seeking within an MP3 doesn't work.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos