 //--------------------------------------
 
 /**
- *  Dispatched when the <code>NetConnection</code> is closed,
- *  whether by being timed out, by calling the <code>close()</code> method, 
- *  or by loading a new video stream.  This event is only dispatched 
- *  with RTMP streams, never HTTP.
+ * Dispatched when the data is received as a download operation progresses.
  *
- *  @eventType spark.events.VideoEvent.CLOSE
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
+ * @eventType flash.events.ProgressEvent
  */
-[Event(name="close", type="spark.events.VideoEvent")]
+[Event(name="bytesDownloadedChange",type="org.osmf.events.BytesDownloadedChangeEvent")]
 
 /**
- * Dispatched when playing completes because the player reached the end of the FLV file. 
- * The component does not dispatch the event if you call the <code>stop()</code> or 
- * <code>pause()</code> methods 
- * or click the corresponding controls. 
+ * Dispatched when the MediaPlayer's state has changed.
+ * 
+ * @eventType org.osmf.events.PlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE
+ */	
+[Event(name="mediaPlayerStateChange", type="org.osmf.events.MediaPlayerStateChangeEvent")]
+
+/**
+ * Dispatched when the <code>playhead</code> property of the MediaPlayer has changed.
+ * This value is updated at the interval set by 
+ * the MediaPlayer's <code>playheadUpdateInterval</code> property.
  *
- *  @eventType spark.events.VideoEvent.COMPLETE
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
+ * @eventType org.osmf.events.PlayheadChangeEvent.PLAYHEAD_CHANGE
+ **/
+[Event(name="playheadChange",type="org.osmf.events.PlayheadChangeEvent")]  
+
+/**
+ * Dispatched when the <code>duration</code> property of the media has changed.
+ * 
+ * @eventType org.osmf.events.DurationChangeEvent.DURATION_CHANGE
  */
-[Event(name="complete", type="spark.events.VideoEvent")]
-
-/**
- *  Dispatched the first time the FLV file's metadata is reached.
- *  The event object has an <code>info</code> property that contains the 
- *  info object received by the <code>NetStream.onMetaData</code> event callback.
- * 
- *  @eventType spark.events.VideoEvent.METADATA_RECEIVED
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-[Event(name="metadataReceived", type="spark.events.VideoEvent")]
-
-/**
- *  Dispatched every 0.25 seconds while the 
- *  video is playing.  This event is not dispatched when it is paused 
- *  or stopped, unless a seek occurs.
- *
- *  @eventType spark.events.VideoEvent.PLAYHEAD_UPDATE
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-[Event(name="playheadUpdate", type="spark.events.VideoEvent")]
-
-/**
- *  Indicates progress made in number of bytes downloaded. Dispatched starting 
- *  when the load begins and ending when all bytes are loaded or there is a network error. 
- *  Dispatched every 0.25 seconds starting when load is called and ending
- *  when all bytes are loaded or if there is a network error. Use this event to check 
- *  bytes loaded or number of bytes in the buffer. 
- *
- *  <p>Dispatched only for a progressive HTTP download. Indicates progress in number of 
- *  downloaded bytes. The event object has the <code>bytesLoaded</code> and <code>bytesTotal</code>
- *  properties.</p>
- * 
- *  @eventType flash.events.ProgressEvent.PROGRESS
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-[Event(name="progress", type="flash.events.ProgressEvent")]
-
-/**
- *  Dispatched when the video is loaded and ready to display.
- *
- *  <p>This event is dispatched the first time the VideoPlayer
- *  enters a responsive state after a new FLV is loaded
- *  with the <code>play()</code> or <code>load()</code> method.
- *  It is dispatched once for each FLV loaded.</p>
- *
- *  @eventType spark.events.VideoEvent.READY
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-[Event(name="ready", type="spark.events.VideoEvent")]
+[Event(name="durationChange", type="org.osmf.events.DurationChangeEvent")]
 
 //--------------------------------------
 //  Other metadata

        dispatchEvent(new Event("sourceChanged"));
    }
    
    override public function setVisible(value:Boolean, noEvent:Boolean=false) : void
    {
        super.setVisible(value, noEvent);
        
        effectiveAutoPlayChanged(true);
    }
    
    private var _parentVisibility:Boolean = true;
    
    mx_internal function set parentVisibility(value:Boolean) : void
    {
        _parentVisibility = value;
        
        effectiveAutoPlayChanged(true);
    }
    
    /**
     *  @private
     *  Sets up the source for use.

        videoPlayer.autoRewind = value;
    }
    
    //----------------------------------
    //  bytesLoaded
    //----------------------------------
    
    [Inspectable(Category="General", defaultValue="0")]
    [Bindable("bytesDownloadedChange")]
    
    /**
     *  The number of bytes of data that have been downloaded into the application.
     *
     *  @return The number of bytes of data that have been downloaded into the application.
     *  @default 0
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function get bytesLoaded():Number
    {
        return videoPlayer.bytesDownloaded;
    }
    
    //----------------------------------
    //  bytesTotal
    //----------------------------------
    
    [Inspectable(Category="General", defaultValue="0")]
    [Bindable("mediaPlayerStateChange")]
    
    /**
     *  The total size in bytes of the data being downloaded into the application.
     *
     *  @return The total size in bytes of the data being downloaded into the application.
     *  @default 0
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function get bytesTotal():Number
    {
        return videoPlayer.bytesTotal;
    }
    
    //----------------------------------
    //  currentTime
    //----------------------------------
    
    [Inspectable(Category="General", defaultValue="0")]
    [Bindable("playheadChange")]
    
    /**
     *  Current time of the playhead, measured in seconds, 
     *  since the video starting playing. 
     *
     *  @default 0
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function get currentTime():Number
    {
        return videoPlayer.currentTime;
    }
    
    //----------------------------------
    //  duration
    //----------------------------------
    
    [Inspectable(Category="General", defaultValue="0")]
    [Bindable("durationChange")]
    
    /**
     *  Duration of the video's playback, in seconds
     *
     *  @return The total running time of the video in seconds
     *  @default 0
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function get duration():Number
    {
        return videoPlayer.duration;
    }
        
    //----------------------------------
    //  enabled
    //----------------------------------
