2013-01-14 58 views
0

我有一个后端sound.php,它可以从Web服务器返回.m4a声音文件,并且可以向声音发出带有ID的Web请求.php返回指定.m4a文件。即sound.php?ID = 1234org.osmf.media.MediaPlayer抛出错误:当前不支持指定的功能

我现在想用org.osmf.media.MediaPlayer和AudioElement和的URLResource

var mediaPlayer:MediaPlayer = new MediaPlayer(); 
    var ae:AudioElement = new AudioElement(new URLResource("http://xxx.com/sound.php?id=12")); 
    mediaPlayer.media = ae; 
    mediaPlayer.play(); 

,并抛出指定能力的错误目前不支持。我已经通过浏览器测试了链接,该链接已经成功返回.m4a文件。

我不明白如果它声称请求方法或返回的文件,有人会有任何想法吗?由于

回答

0

尝试设置MediaPlayer.autoPlaytrue或者你应该等到媒体加载,这是通过mediaPlayerStateChange活动信号,与国家READY

[更新]

正如NetStream - Adobe ActionScript® 3 (AS3) API Reference页陈述以及在Supported codecs | Flash Player页:

Flash Player 9 Update 3 plays files derived from the standard MPEG-4 container format that contain H.264 video and/or HE-AAC audio, such as F4V, MP4, M4A, MOV, MP4V, 3GP, and 3G2. One thing to note is that protected MP4 files, such as those downloaded from iTunes or digitally encrypted by FairPlay, are not supported.

看来你将不得不尝试NetStream方法。

+0

感谢您的回复,我尝试使用 MediaPlayer.autoPlay和mediaPlayerStateChage事件,并且状态为READY,但仍会抛出相同的错误。我现在想知道如果MediaPlayer不支持.m4a文件.. 我发现事件mediaPlayerStateChange只回放与播放错误。 – bcw

+0

它工作,如果我使用NetStream.However,它不能播放音频文件,除非整个文件被下载。不像声音,它只支持mp3,但它可以逐步下载并播放音频文件,无需媒体流媒体服务器。 – bcw

相关问题