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
Developer
Posts: 45
Registered: ‎05-01-2013
My Device: Z10
My Carrier: LIME

Prevent screen from sizing/Background music

Hi guys, I've developed a game and its working flawlessly on the Z10, but there is one issue that is bugging me. How can I prevent users from resizing the screen with two fingers? Or should I leave it as it is?

 

Also, how do I pause the background music when the game is minimized to a tile?

 

 

 

Developer
Posts: 45
Registered: ‎05-01-2013
My Device: Z10
My Carrier: LIME

Re: Prevent screen from sizing/Background music

Ok, I used <meta name="viewport" content="width=760px, user-scalable=no"> to avoid the scaling, but still the problem with the music
Trusted Contributor
Posts: 118
Registered: ‎03-06-2013
My Device: Blackberry Z10
My Carrier: Airtel

Re: Prevent screen from sizing/Background music

for music issue, u can try getting some kind of pause/minize event and try to pause the music upon that event.
--------
- If a post contains the solution to the problem, please click "Accept as Solution"
- If a post contains helpful content, please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Developer
Posts: 45
Registered: ‎05-01-2013
My Device: Z10
My Carrier: LIME

Re: Prevent screen from sizing/Background music

Thank you very much Smiley Happy
I've seen other persons with the same problem as I am trying to get their audio to loop, Im using Coda2 to build by application and every browser is looping perfectly, however when using Ripple, it doesnt seem to loop the audio when using loop="loop" or "true"

How do I loop audio using webworks?
Developer
Posts: 45
Registered: ‎05-01-2013
My Device: Z10
My Carrier: LIME

Re: Prevent screen from sizing/Background music

[ Edited ]

I've tried the following and still no success Smiley Sad

 

var audio = document.createElement('audio');
audio.src='resources/classic-checkers.aac';
audio.controls = false;
audio.addEventListener('ended', function () {
setTimeout(function () { audio.play(); }, 1000);
}, false);
audio.play();
document.body.appendChild(audio);

 

 

Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Prevent screen from sizing/Background music

You can pause using the following event:

 

blackberry.app.pause

 

@erikjohnzon
erjohnson@blackberry.com
Developer
Posts: 45
Registered: ‎05-01-2013
My Device: Z10
My Carrier: LIME

Re: Prevent screen from sizing/Background music

Thank you, but for some unknown reason, the music is still playing, neither does it loop regardless how it is inserted.

 

Im gonna keep trying and trying until I run out of coffee.

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

Re: Prevent screen from sizing/Background music

You need to set the 'loop' attribute to true in order to loop audio. You are setting 'autoplay' to true, but I don't see anywhere that you set loop.

 

For pausing you need to create an event listener for the app pausing and resuming. The pause event is named by Eric. Checkout the docs for blackberry.app to see an example for how to listen for pause and resume events.

 

https://developer.blackberry.com/html5/apis/blackberry.app.html

 

You can implement listening for those events, and call a method on your audio object to stop it or play it depending on what the app does.

Tim Windsor
Open Source Technical Lead