1 person found this helpful
I see that you are using the MediaPlayer, and are getting a trait not found exception. This error is actually dependent on the media you have loaded into the MediaPlayer's source element. Most media elements add the Seekable trait after load completes. You can listen for load state changes on the mediaPlayers state property (or throught the loadable trait). The MediaPlayer should auto load all media, so you should see it enter the loading phase, but enter the playback error phase at some point.
To recieve these Playback errors, add the event listener to the MediaPlayer called MediaErrorEvent.MEDIA_ERROR. The MediaError should contain more information about why your media has failed to load. Here is some sample code (change the video url to something real):
var mediaPlayer:MediaPlayer = new MediaPlayer();
mediaPlayer.source = new VideoElement(new NetLoader(), new URLResource('http://exmaple.com/test.flv'));
private function onPlayerStateChange(event:PlayerStateChangeEvent):void
//your media player state watching code here. See PlayerStateChangeEvent for more info
private function onMediaError(event:PlayerStateChangeEvent):void
//your media error handling code, ussually this means your urls is incorrect.
Thanks for that. Now the errors are gone, and now the video will play ok.
With one exception. The video refuses to actually seek. The traces fire in the before and after seek functions, but the video always starts playing from 0 for some reason.
I figured out the seek problem
I thought to myself: what if the video doesn't have the duration that I want to seek to when I try to seek?
So I threw in a listener for durationChange, and discovered that the MediaPlayerStateChangeEvent fires before the DurationChangeEvent, causing my seek to happen on a video with a NaN duration.
Changed the initial listener to watch for durationChange, rather than mediaPlayerStateChange, and it works as expected now.
Thanks for the help.
I als come upon the problem,perhaps the browser caused the phenomena,besides the speed of network is very very slow so that the video can not play properly,when the condition appear, I was very very angry, sometimes i change the browser,but if i do so,the effect is profoud, I will choose to shut off the computer.
If you want to savvy more information about mobile phone, please come to http://www.nowsupplier.com/
logo.png 6.3 K