Hi,
When trying to load
an MP3 file encoded with iTunes (latest one v6.0.5.20), the MP3 starts playing
but it stops when the loading is completed.
An Event.COMPLETE is generated just followed by an
Event.SOUND_COMPLETE (whereas the sound is not completed at all and should
continue to play).
After that, it is
not possible to start the MP3 anymore.
It might be an ID3
issue? (apparently, the ID3Info are not properly loaded)
Here is a template
to reproduce the problem, a copy/paste from the LiveDocs.
It works fine with
any MP3 files not encoded with iTunes.
<?xml
version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="creationCompleteHandler()">
<mx:Script>
<![CDATA[
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.utils.Timer;
private var soundUrl:String = "http://localhost/SomeITunesEncodedFile.mp3";
private var soundFactory:Sound;
private var channel:SoundChannel;
private var positionTimer:Timer;
public function creationCompleteHandler():void {
var request:URLRequest = new URLRequest(soundUrl);
soundFactory = new Sound();
soundFactory.addEventListener(Event.COMPLETE, completeHandler);
soundFactory.addEventListener(Event.ID3, id3Handler);
soundFactory.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
soundFactory.addEventListener(ProgressEvent.PROGRESS, progressHandler);
soundFactory.load(request);
channel = soundFactory.play();
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
positionTimer = new Timer(50);
positionTimer.addEventListener(TimerEvent.TIMER, positionTimerHandler);
positionTimer.start();
}
private function positionTimerHandler(event:TimerEvent):void {
trace("positionTimerHandler: " + channel.position.toFixed(2));
}
private function completeHandler(event:Event):void {
trace("completeHandler: " + event);
}
private function id3Handler(event:Event):void {
trace("id3Handler: " + event);
}
private function ioErrorHandler(event:Event):void {
trace("ioErrorHandler: " + event);
positionTimer.stop();
}
private function progressHandler(event:ProgressEvent):void {
trace("progressHandler: " + event);
}
private function soundCompleteHandler(event:Event):void {
trace("soundCompleteHandler: " + event);
positionTimer.stop();
}
]]>
</mx:Script>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="creationCompleteHandler()">
<mx:Script>
<![CDATA[
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.utils.Timer;
private var soundUrl:String = "http://localhost/SomeITunesEncodedFile.mp3";
private var soundFactory:Sound;
private var channel:SoundChannel;
private var positionTimer:Timer;
public function creationCompleteHandler():void {
var request:URLRequest = new URLRequest(soundUrl);
soundFactory = new Sound();
soundFactory.addEventListener(Event.COMPLETE, completeHandler);
soundFactory.addEventListener(Event.ID3, id3Handler);
soundFactory.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
soundFactory.addEventListener(ProgressEvent.PROGRESS, progressHandler);
soundFactory.load(request);
channel = soundFactory.play();
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
positionTimer = new Timer(50);
positionTimer.addEventListener(TimerEvent.TIMER, positionTimerHandler);
positionTimer.start();
}
private function positionTimerHandler(event:TimerEvent):void {
trace("positionTimerHandler: " + channel.position.toFixed(2));
}
private function completeHandler(event:Event):void {
trace("completeHandler: " + event);
}
private function id3Handler(event:Event):void {
trace("id3Handler: " + event);
}
private function ioErrorHandler(event:Event):void {
trace("ioErrorHandler: " + event);
positionTimer.stop();
}
private function progressHandler(event:ProgressEvent):void {
trace("progressHandler: " + event);
}
private function soundCompleteHandler(event:Event):void {
trace("soundCompleteHandler: " + event);
positionTimer.stop();
}
]]>
</mx:Script>
</mx:Application>
Benoit
Hediard
PS: This problem has been raised during the beta,
but without any answers. ;)
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

