Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
ianmills
Posts: 4
Registered: ‎07-07-2011
My Device: Playbook
My Carrier: Sprint

HTML5Audio object does not play MP3 stream without Alert message

[ Edited ]

I am running into an interesting situation where everytime I try to play an audio stream it stops once I close the alert message. As a matter of fact if I do not include the alert message in the method I never hear the audio at all.

 

Any thoughts on why the audio may not be playing/stopping after the method call?

 

My first assumption was the audio object was being reference locally versus globally so I moved it outside the function but still no luck.

 

Below is a snippet of the code.

Html file:

<img src="images/btn_play_main.png" class="button" id="play_button" onClick="playOrpause()"/>

 

Script file:

audio = new Audio('http://shoutcast.canopyradio.com:38700/;');

function playOrpause()
{
    try{
    if(audio.paused){
        $("#button").attr("src","images/btn_pause_main.png");
        audio.play();
        alert("Play");
    }else{
        $("#button").attr("src","images/btn_play_main.png");   
        audio.pause();
        alert("Paused");
    }
        }
    catch(e) {
        alert("Exception [scripts.js showAbout()]: " + e);
    }
}

 

UPDATE: Added an alert message to check the state and the audio object thinks it is still playing but there is no audio on the actual playbook. In ripple and vmware emulator everything works fine.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: HTML5Audio object does not play MP3 stream without Alert message

Can you post the version of PlayBook OS you have loaded on the actual Tablet device?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Contributor
ianmills
Posts: 4
Registered: ‎07-07-2011
My Device: Playbook
My Carrier: Sprint

Re: HTML5Audio object does not play MP3 stream without Alert message

OS Version 1.0.6.2390

 

Also I've found that this doesnt play either:

<audio id="footer_btn"  src="http://shoutcast.canopyradio.com:38700/;stream.nsv" controls="controls"/>

 which is a standard HTML5 Audio tag.

Even if i type the URL straight into the browser, a player control shows up but it doesnt play the stream.

Please use plain text.
Regular Contributor
Cesar_Vanatur
Posts: 76
Registered: ‎02-17-2010
My Device: Storm
My Carrier: Vodafone

Re: HTML5Audio object does not play MP3 stream without Alert message

Hello ianmills.

HTML 5 supports audio streaming ?

Some days ago I try to do an audio streaming app and I can´t play any audio stream.

Thanks, kind regards.
Please use plain text.
Trusted Contributor
mobilvar
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon

Re: HTML5Audio object does not play MP3 stream without Alert message

Did you ever get a resolution for this?

I built an applicaiton based on HTML5. Like you, everything works in Ripple. But when I test on an actual device, the stream does not play.

Please use plain text.