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
Bulow
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 :smileyhappy:

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
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.
Please use plain text.
Contributor
appcannon
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.

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
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.
Please use plain text.
Contributor
appcannon
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.

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
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.
Please use plain text.
Contributor
appcannon
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?

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
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.
Please use plain text.
Contributor
appcannon
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.

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
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.
Please use plain text.