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
Trusted Contributor
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon
Accepted Solution

HTML5 Audio Does not Play when SRC is Switched

All,

I have a web app that streams audio.

When I start it and select a stream, that stream plays as expected.

When I attempt to switch from that stream to another url, the program gets to the point where the new url is bufferred, but nothing plays. I don't hear anything. Any idea what may be going on here? 

 

Trusted Contributor
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon

Re: HTML5 Audio Does not Play when SRC is Switched

I'm encountering this problem on a curve 9330 running OS6.

Trusted Contributor
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon

Re: HTML5 Audio Does not Play when SRC is Switched

Also seeing this problem on OS7 device, but with slightly different befhavior.

On the OS7 Torch, my tester is saying that the whole app crashes when she tries to switch to a different stream.

On the OS6 devices it doesn't crash but sits there and says that it is buffering data but no audio comes out.

Again, none of this behavior appears on the Ripple Emulator or in Chrome.

Trusted Contributor
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon

Re: HTML5 Audio Does not Play when SRC is Switched

[ Edited ]

Here's my code:

 

 

//global audio variable here

var audio = new Audio;

audio.setAttribute("autoplay","autoplay");

//Then within an function in the same jscipt file, I set the url. It's                  

//when this runs a second time with a different url that it stalls.

audio.pause();

audio.setAttribute("src", "");

audio.setAttribute("src", result.rows.item(q).url_);

audio.load();

 

 

Can anybody help? I can't really go forward unless I can get past this problem.

Trusted Contributor
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon

Re: HTML5 Audio Does not Play when SRC is Switched

Anybody?

Highlighted
Trusted Contributor
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon

Re: HTML5 Audio Does not Play when SRC is Switched

I've been researching this issue for several days and tried numerous approaches to get this to work.

Nothing seems to work. I am pretty sure at this point that the code I have SHOULD work and that there is a bug in the Blackberry browser. I am now trying to set an audio element up in an external webpage and then reference that audio element in an iframe that's insertiged in my main page. I don't like going this route because with additional complexity there's more that can go wrong. 

 

 

RIM, can you give any direction here? Urgently trying to get this project completed but I can't release a program that I knnow people are going to have to repeatedly restart.

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: HTML5 Audio Does not Play when SRC is Switched

I'll take a look at it. What devices and OS's have you tried? Can you provide the full OS versions?

 

Have you tried creating a new Audio element, instead of changing the source?

Tim Windsor
Open Source Technical Lead
Trusted Contributor
Posts: 119
Registered: ‎11-28-2011
My Device: 9930
My Carrier: Verizon

Re: HTML5 Audio Does not Play when SRC is Switched

THANK YOU THANK YOU THANK YOU!

 

I have tried creating an element, yes, but had the same result.

My test device is a Curve 9330 running v6.0.0.524.

I also tested on an OS7 device but don't have the precise version. 

 

If I can get this working, my app, which i've been working on for about five months,  is good to go. Please tell me if you're able to find a solution or if you aren't. I'd appreciate that.

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: HTML5 Audio Does not Play when SRC is Switched

I've been able to make this work very well on PlayBook, but found a test site that suggests BlackBerry 6 doesn't support it (though BlackBerry 7 is supposed to). Have you tried reinitializing the audio object on 6.0? I'm still investigating but wanted to give you a quick update.

 

http://areweplayingyet.org/support-hot-swapping-src

Tim Windsor
Open Source Technical Lead
Developer
Posts: 161
Registered: ‎02-08-2012
My Device: PlayBook
My Carrier: None yet

Re: HTML5 Audio Does not Play when SRC is Switched

Perhaps a pause before changing the source or destroying it, might help. Some old browsers would carry on with the rest of whatever they were streaming to begin with on a src change. I've seen instances of half a dozen songs playing simultaneously.