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: 
learnerDev
Visitor

VideoPlayer and AudioApp

Hello

I almost finished developing an app on VideoPlayer example but i have a category which is radio.

i could like to know to integrate audio inside videoplayer as audio app tells me the artist name etc while the videoplayer can only just play the streams.

thanks a lot in advance fella's!

regards,
Learner.
0 Kudos
7 REPLIES 7
akhunaton
Visitor

Re: VideoPlayer and AudioApp

I have the exact same question. I am building a channel with the videoplayer but I also want to have a category play mp3's. Any direction would be greatly appreciated.
0 Kudos
RokuJoel
Binge Watcher

Re: VideoPlayer and AudioApp

Assuming you are using the roPosterScreen for your channel, you would include as part of the posters representing each media item something that lets you know if it is audio or video. Conditionally based on that, you would launch a function to play audio, or launch a function to play video.

Rough example:

sub main()
poster=createobject("roposterscreen")
poster.setliststyle("flat-category")
content=[{shortdescriptionline1:"audio item"
streamurl:"http://www.myserver.com/my.mp3"
streamformat:"mp3"
action:"playAudio"}

{shortdescriptionline1:"video item"
streamformat:"mp4"
action:"playVideo"
video:[{url:"http://www.myserver.com/my.video.mp4",qualities:"SD",streamformat:"mp4",title:"STUFF",bitrate:"500"}]}]

poster.setcontentlist(content)
port=createobject("romessageport")
poster.setmessageport(port)
poster.show()
while true
msg=wait(0,port)
if type(msg)="roPosterScreenEvent" then
if msg.Islistitemselected() then
ndx=msg.getindex()
if content[ndx].Action="playVideo" then
playvideo(content[ndx])
else if content[ndx].Action="playAudio" then
playaudio(content[ndx])
end if
end if
end if
end while
end sub

function playaudio(audio as object)
?"this is where your audio player goes"
end function

function playvideo(video as object)
?"this is where your video player goes"
end function
0 Kudos
onevoisses
Visitor

Re: VideoPlayer and AudioApp

RokuJoel

"RokuJoel" wrote:
Assuming you are using the roPosterScreen for your channel, you would include as part of the posters representing each media item something that lets you know if it is audio or video. Conditionally based on that, you would launch a function to play audio, or launch a function to play video.

Rough example:

sub main()
poster=createobject("roposterscreen")
poster.setliststyle("flat-category")
content=[{shortdescriptionline1:"audio item"
streamurl:"http://www.myserver.com/my.mp3"
streamformat:"mp3"
action:"playAudio"}

{shortdescriptionline1:"video item"
streamformat:"mp4"
action:"playVideo"
video:[{url:"http://www.myserver.com/my.video.mp4",qualities:"SD",streamformat:"mp4",title:"STUFF",bitrate:"500"}]}]

poster.setcontentlist(content)
port=createobject("romessageport")
poster.setmessageport(port)
poster.show()
while true
msg=wait(0,port)
if type(msg)="roPosterScreenEvent" then
if msg.Islistitemselected() then
ndx=msg.getindex()
if content[ndx].Action="playVideo" then
playvideo(content[ndx])
else if content[ndx].Action="playAudio" then
playaudio(content[ndx])
end if
end if
end if
end while
end sub

function playaudio(audio as object)
?"this is where your audio player goes"
end function

function playvideo(video as object)
?"this is where your video player goes"
end function


I have tried this on the videoplayer,but it is not going to my categories screen.

Would this be better placed under the homescreen as a special category and called from there.This example works from the simple player and custom player. but not from the videoplayer SDK.

relevant postings are
viewtopic.php?f=34&t=38074&start=0&hilit=video+player
viewtopic.php?f=34&t=39414&start=0
viewtopic.php?f=34&t=33396&start=0

Where this approach was attempted but I look at the NEWSCASTER channel(fox in particular) where the audio and video app
was done,but the radio does not play.Is this at all possible to have both audio and video in category leaf?

I am completing my channel for submission and do not want to waste time if it is not.In the meantime I have created a private channel for audio to play the radio.
Channel: Goaheadmission
O/S : Linux
Home media: MYTHROKUPLAYER With Homerun
0 Kudos
RokuJoel
Binge Watcher

Re: VideoPlayer and AudioApp

The answer is, you can put it anywhere you want. If you are in a hurry to publish, then you will try to choose a way to include the audio content that will require the least amount of hacking to make it work. The home row might be a good place for that, or you can check the type of content at the moment the user clicks "Play" and at that point determine whether you need to call a video player component or an audio player component for that content.

- Joel
0 Kudos
onevoisses
Visitor

Re: VideoPlayer and AudioApp

just my thoughts were correct.I think in the holidays I will look at those hack.but thanks
Channel: Goaheadmission
O/S : Linux
Home media: MYTHROKUPLAYER With Homerun
0 Kudos
dew
Visitor

Re: VideoPlayer and AudioApp

Hi I just found this thread and this is what I am looking for but I am sorry I do not understand. IF i have set up my channel using the videoplayer example (xml files) and I want to be able to select a radio channel from this I need to use the code above and put it where? If some one could point me in the right direction I would appreacate it.
I just want to add a live radio stream to the videoplayer. sounds easy:) 😄 but it does not seem to be 😞 :? Cheers
DEW
0 Kudos
newchannel
Roku Guru

Re: VideoPlayer and AudioApp

Did you discover how to use videoplayer and have a category on homescreen that plays internet radio stream? This is something I am needing to do, also.

Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos