If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Contributor
barkerdogg
Posts: 28
Registered: ‎04-12-2012
My Device: Torch 9800, Playbook
My Carrier: LIME

HTML 5 Audio tag fails after answering a phone call (WebWorks)

Dear All,

 

I have a serious issue with the HTML5 audio tag on Balckberry 6 and 7.  Details:

 

If you set up a simple javascript page which creates an HTML5 audio object and then calls its play function once every several seconds using setTimeout it works as expected.... unless you get an incoming call and you answer. If you do this when the call has ended your audio object can no longer activate. I tried to catch an exception to see what the problem is but i did not get any exception on the device simulator. ( i have confirmed this is an issue that affects real life devices)

 

the only way i have found around this issue so far is to use the blackbery.phone library to check if the user is in an activecall before attempting to call the play function of the audio tag. 

 

Is there another way to determine if the HTML5 tag is able to play audio (as in the audio subsystem isnt busy) before calling the play function? 

 

The reason why i want another way is that doing the blackberry.phone method makes the phone asks the user to give your app permission to access "phone information". That is a very sinister sounding warning and may turn off potential users who may think ur app is trying to do more than just figure out if it can play a sound.

 

Thank you. Looking forward to your reply.

Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: HTML 5 Audio tag fails after answering a phone call (WebWorks)

Hello Barkerdogg,

 

Are you seeing the same behaviour when using the browser?

 

Can you provide the OS version of the devices you have seen affected by this issue?

 

I have performed some tests and I can confirm that this issue is fixed on the latest publicly available release of BB6 for the 9800 (in my case - Rogers 6.0.0.666).

I have also tested this with a 9900 and 9810 running 7.1.0.391 and it appears to be working as expected.

 

Here is the code I used:

 

<script>
	var audio = new Audio();
	audio.src='kick.wav';
	audio.controls = true;
	
	var t = setInterval(function(){		
		audio.play();	
	},2000);
</script>

 Looking forward to your reply.

Please use plain text.
Contributor
barkerdogg
Posts: 28
Registered: ‎04-12-2012
My Device: Torch 9800, Playbook
My Carrier: LIME

Re: HTML 5 Audio tag fails after answering a phone call (WebWorks)

Hello anzor_b,

 

Im not sure if i made this quite clear but this problem  manifests in apps developed with webworks. Whether you run the created app on the device or the simulator the problem occurs. Please create a webworks app with your code and test it on any simulator or actual device. Let the app run and play the sound a couple times then simulate an incoming call or actually call the device if its an actual device, answer the call, wait a couple seconds then hang up. You will notice the app will no longer play the sound.

 

Please note i actually created a webworks app with only your code and one modification to change the name of the file and the length of the timeout and the issue occurs. Please try this and let me know if you experience the same. I am currently using webworks 2.3.1.5 and tested this with device simulators for the 9700 ,9780 and 9860, plus several versions of the OS's on a 9800 and a 9360 (7.0 and 7.1)

 

Here is the code i used in its entirety. (contents of index.html)

 

<html>
</html>
<script>
 var audio = new Audio();
 audio.src='alarm.mp3';
 audio.controls = true;
 
 var t = setInterval(function(){  
  audio.play(); 
 },4000);
</script>

 

 

 

 

Thank you in advance for you soonest repsonse

Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: HTML 5 Audio tag fails after answering a phone call (WebWorks)

[ Edited ]

Hello barkerdogg,

 

I realise that you are seeing this issue when applications are packaged using WebWorks, however it is always a good test to see if the browser behaves the same way (as they are both tied into WebKit at the core). To test, host the files on a Web Server, and point the browser on the device to index.html, call, pick up, wait a few seconds and hang up.

 

The snippet I provided is from an application I have been testing all day using different builds and devices. For 6.0 code, I am seeing the issue you are experiencing in builds prior to the current build (in my case a 9800 running 6.0.0.666). I am not able to reproduce this with 6.0.0.666 and it works as expected.

 

I will continue to test with 7.0 and 7.1 and get back to you, but 6.0 devices running the above build or later should not experience this issue. This I have confirmed firsthand. Can you test a 6.0 device (example a 9800) running the above build and confirm please?

 

Edit: I am using WebWorks version  2.3.1.5.

Please use plain text.