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

Adobe AIR Development

Reply
Regular Contributor
Posts: 51
Registered: ‎02-02-2011
My Device: Not Specified

Re: Problem with 0.9.3 beta simulator: audio gone

@ddluk: I don't think it will make a difference if you load it externally or not, I think the simulator is just broken in this release.

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Problem with 0.9.3 beta simulator: audio gone

It's OK to embed short sound files.  My examples was to give another sample to BB in how I play sound so it might give another data point why sound is not working in the 0.9.3 simulator.

BlackBerry Development Advisor
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: Problem with 0.9.3 beta simulator: audio gone

Thanks you guys for sample code. I will make sure we will include them in the test suite for the next version of the simulator. Apparently there is a bug with audio driver which we overlooked in in this release.

Also thank you very much for being so good beta testers and so patient with us. Looking forward to see your apps!

Contributor
Posts: 16
Registered: ‎01-27-2011
My Device: Playbook
My Carrier: na

Re: Problem with 0.9.3 beta simulator: audio gone

Definitely must be missing audio support in this release for native apps.  My app works 100% now except for audio playing.  It streams MP3 data from a server and everything else works.  I'm half tempted to submit it as I'm not using anything out of the ordinary for flash sound support.  Even tried some audio tests through the new web browser.  Works fine in the web browser... well... worked... then crashed the web browser. 

 

All thats left is getting the splash screen and icons setup correctly for my app. 

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Problem with 0.9.3 beta simulator: audio gone

 


pablosbrain wrote:

... My app works 100% now except for audio playing.  ... I'm half tempted to submit it as I'm not using anything out of the ordinary for flash sound support.  Even tried some audio tests through the new web browser. 


 

Don't be just half tempted. I'm very confident that it you test on the old simulator and have working audio, it will work fine.  I'm near ready to submit my app as well, and I'm just going to ignore the new simulator for anything audio-related.

 

I'm really hoping they can come up with a workaround that doesn't involve waiting another month for the next SDK... this release would be quite adequate if it weren't for this issue.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Problem with 0.9.3 beta simulator: audio gone

 


imrahil wrote:

I'm using casting to SoundChannel variable from Sound's "play" method. But, because this is broken in latest 0.9.3, my SoundChannel variable is always null...

Later I'm using this SoundChannel variable and its SOUND_COMPLETE event to react and change UI.

 

Any idea how to handle that? Try/catch clause? Or maybe something more elegant...


 

(Sorry not to reply sooner... had to go out for the evening just as I replied to your private message about this.)

 

A few items with this.  One is the "casting to SoundChannel" part.  If you mean you're just assigning the result of sound.play() to a "var channelSmiley FrustratedoundChannel", then that should be safe, as far as it goes. I think "casting", however, technically refers to forcing a reference to be treated as a different type, such as when you downcast an Event to one of its descendents, or for conversions such as Number(someint).  I suspect doing that with a null, as in "channel = SoundChannel(null)", would result in a runtime error.  Is that what you're getting?  If so, you don't need to attempt the casting, and can avoid the runtime error by simply removing it.

 

If your issue is that you just want to avoid problems with this null value, then just do a basic truth test on it (as I showed before), with something like:

 

var chan:Channel = sound.play();
...

// later on:
if (chan) {
   // do stuff with the Channel only when it's non-null
}

 Lastly, if the problem is that you still want that SOUND_COMPLETE-dependent code to execute so you can test it's behaviour, then I guess you just need to set up some test fixture to fake it.  The simplest would maybe look like this:

 

if (chan) {
    chan.addEventListener(Event.SOUND_COMPLETE, onComplete);
}
else {
    const FAKE_SOUND_DURATION:Number = 2500; // milliseconds
    // fake event after fake sound "completes"
    setTimeout(FAKE_SOUND_DURATION, onComplete, new Event(Event.SOUND_COMPLETE));
}

A try/except instead of the conditional would be perfectly adequate as a way to catch the problem with a "null" channel.

 

 


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
Posts: 16
Registered: ‎01-27-2011
My Device: Playbook
My Carrier: na

Re: Problem with 0.9.3 beta simulator: audio gone

 


peter9477 wrote:

Don't be just half tempted. I'm very confident that it you test on the old simulator and have working audio, it will work fine.  I'm near ready to submit my app as well, and I'm just going to ignore the new simulator for anything audio-related.

 

I'm really hoping they can come up with a workaround that doesn't involve waiting another month for the next SDK... this release would be quite adequate if it weren't for this issue.


Thanks for the push!  I just need to get the splash screen and icons all worked out and I'll probably submit in the next day or so.  Can't wait to see what everyone has been cooking up for apsp!

 

Highlighted
Contributor
Posts: 12
Registered: ‎01-16-2011
My Device: Z10 Limited Edition
My Carrier: Play

Re: Problem with 0.9.3 beta simulator: audio gone

 


peter9477 wrote:


Lastly, if the problem is that you still want that SOUND_COMPLETE-dependent code to execute so you can test it's behaviour, then I guess you just need to set up some test fixture to fake it.  The simplest would maybe look like this:

 

if (chan) {
    chan.addEventListener(Event.SOUND_COMPLETE, onComplete);
}
else {
    const FAKE_SOUND_DURATION:Number = 2500; // milliseconds
    // fake event after fake sound "completes"
    setTimeout(FAKE_SOUND_DURATION, onComplete, new Event(Event.SOUND_COMPLETE));
}


 

That's exactly what I was looking for! Smiley Happy With only one small change: I prefer TImer class instead of "setTimeout"...

 

Kind regards,

Jarek

New Contributor
Posts: 8
Registered: ‎02-26-2011
My Device: PlayBook

Re: Problem with 0.9.3 beta simulator: audio gone

Is there a download link to v0.9.2 someplace? I would like to get this to test the sound in my app, but I can't find a link. Thanks!

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Problem with 0.9.3 beta simulator: audio gone

If you can run the app as an AIR app, you can test the audio.  If it works there, you will be OK.