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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 13
Registered: ‎11-17-2012
My Device: developer (playbook and bb10)
My Carrier: NA

Re: App doesn't fit to screen

ah, lucky you then Smiley Happy

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: App doesn't fit to screen

@Bulow: Either of those would be valid options.

 

@appcannon: I've seen WAV and MP3 files working in the past. I'm a bit surprised at the WAV failure, but I'd recommend giving it a shot with MP3s to see if that works. Otherwise without audio may be necessary while we look into the audio failing.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Highlighted
Contributor
Posts: 40
Registered: ‎11-11-2012
My Device: Developer
My Carrier: None

Re: App doesn't fit to screen

Yep, MP3s still didn't work.

 

All I'm doing is a simple implementation of HTML5 audio.

var audio = new Audio('audio.wav');

audio.play();

 

I have no idea why it doesn't work, but it does completely freeze up Webworks.

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: App doesn't fit to screen

Here's a code sample that I use pretty often and have had success with.

 

var track = document.createElement('audio');
track.setAttribute('src', 'audio.mp3');
track.setAttribute('preload', 'auto');
track.setAttribute('loop', 'true');
track.setAttribute('autoplay', 'true');
track.load();

 

However, I would expect what you have to work just fine. Just to check, are you running that code after the DOMContentLoaded event? Example:

 

<!DOCTYPE html>
<html>
    <head></head>
    <script type="text/javascript">
        window.addEventListener('DOMContentLoaded', function () {
            var audio = new Audio('audio.wav');
            audio.play();
        }, false);
    </script>
</html>

 

Apologies if there are typos, I wrote that out in this reply window, but I think I got it right. Basically are you waiting until the DOM has completed loading before you attempt to create an Audio instance?


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Contributor
Posts: 40
Registered: ‎11-11-2012
My Device: Developer
My Carrier: None

Re: App doesn't fit to screen

I'll try that.  I've been running it via the jQuery

$(document).ready();

 which I would assume runs off of the domcontentloaded event.

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: App doesn't fit to screen

Right, jQuery's ready function should work just fine in that case.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Contributor
Posts: 40
Registered: ‎11-11-2012
My Device: Developer
My Carrier: None

Re: App doesn't fit to screen

Nope.  Just tried the following, and Javascript still stopped.

 

 $(document).ready(function(){
        var track = document.createElement('audio');
        track.setAttribute('src', 'sound/point.mp3');
        track.setAttribute('preload', 'auto');
        track.load();
        track.play();
  });

 Is there something that needs to be set in the config.xml to allow HTML5 audio or something?

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: App doesn't fit to screen

Nope, HTML5 audio should just work out-of-the-box. Let me build/test a BAR file and I'll share it here once I've confirmed it working on my test device. Not that it should matter, but just to confirm, are you running a Dev Alpha A or Dev Alpha B?


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Contributor
Posts: 40
Registered: ‎11-11-2012
My Device: Developer
My Carrier: None

Re: App doesn't fit to screen

I don't have a device period.  I suppose it could be a simulator issue, and have nothing to do with Webworks.

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: App doesn't fit to screen

I'll check on both in that case.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.