1 Reply Latest reply on Aug 10, 2009 8:09 AM by bringrags

    Loadable AudioElement doesn't dispatch LOADABLE_STATE_CHANGE?

    flexdeveloper.eu

      Can anyone cast their eye over this if they get a chance?

       

      As AudioElement subclasses LoadableMediaElement, I was under the assumption that it would dispatch LOADABLE_STATE_CHANGE when the media has loaded using:

       

      player = new MediaPlayer();

      player.addEventListener( MediaPlayerCapabilityChangeEvent.VIEWABLE_CHANGE, onViewable );

      player.addEventListener( MediaPlayerCapabilityChangeEvent.SPATIAL_CHANGE, onSpatial );

      player.source = new AudioElement( new NetLoader(), new URLResource( LOCATION ) );

       

      var loadable:ILoadable = _player.source.getTrait( MediaTraitType.LOADABLE ) as ILoadable;

      loadable.addEventListener( LoadableStateChangeEvent.LOADABLE_STATE_CHANGE, onLoaded );

       

      But it seems that when I load these using MediaPlayer and regular HTTP, the LoadableStateChangeEvent.LOADABLE_STATE_CHANGE isn't dispatched, I also checked VideoElement, and the same is true. If I use ImageElement, it is dispatched.

       

      Am I doing something wrong, or is there no way of establishing if a progressive Audio/VideoElement has completed loading?

        • 1. Re: Loadable AudioElement doesn't dispatch LOADABLE_STATE_CHANGE?
          bringrags Level 4

          You should get LoadableStateChangeEvents when loading video or audio.  Not sure why it's not happening for you (your code looks fine at first glance).  I'd recommend looking at the CompositionPlayer sample app (included in the latest drop), as it has audio, video, and image test cases that you could use as a comparison point.  (The MainWindow class has an onLoadState method that gets called on state change events, and which updates the UI.)  If you still can't isolate the issue, feel free to post (or send) a sample that we could run.