The following table summarizes the different states the MediaElement can be in. These states correspond to the enumeration values of the MediaElementState enumeration.
Value | Description |
|---|
AcquiringLicense | Only applicable when serving DRM-protected content: The MediaElement is acquiring a license required to play DRM-protected content. After OnAcquireLicense has been called, the MediaElement remains in this state until SetLicenseResponse has been called. |
Buffering | The MediaElement is loading the media for playback. Its Position does not advance during this state. If the MediaElement was already playing video, it continues to display the last displayed frame. |
Closed | The MediaElement contains no media. The MediaElement displays a transparent frame. |
Individualizing | Only applicable when serving DRM-protected content: The MediaElement is in the process of ensuring that proper individualization components (only applicable when playing DRM-protected content) are installed on the user's computer. For more information, see Digital Rights Management (DRM). |
Opening | The MediaElement is validating and attempting to open the Uniform Resource Identifier (URI) specified by its Source property. |
Paused | The MediaElement does not advance its Position. If the MediaElement was playing video, it continues to display the current frame. |
Playing | The MediaElement is playing the media specified by its source property. Its Position advances forward. |
Stopped | The MediaElement contains media, but it is not playing or paused. Its Position is 0 and does not advance. If the loaded media is video, the MediaElement displays the first frame. |
The following table summarizes these MediaElement states versus the actions taken on the MediaElement (for example, Play method called, Pause method called, and so on).
State | Source set | Play() | Pause() | Stop() | Seek() | Default exit condition |
|---|
Closed (default) | Opening | Not specified | Not specified | Not specified | Not specified | |
Opening | Opening (new source) | Not specified | Not specified | Not specified | Not specified | If source is valid: Buffering (if AutoPlay == true) or Stopped (if AutoPlay == false) (MediaOpened) If source is invalid: Opening (MediaFailed) |
Buffering | Opening | Playing | Paused | Stopped | Buffering (new position) | BufferingTime is reached: Playing |
Playing | Opening | No-op | Paused | Stopped | Buffering (new position) | End of stream: Paused End of buffer: Buffering |
Paused | Opening | Buffering | No-op | Stopped | Paused (new position) | |
Stopped | Opening | Buffering | Paused | No-op | Paused (new position) | |
As you can see in the preceding table, the state that is available to the MediaElement depends on its current state. For example, for a MediaElement that is currently in the state of Playing, if the source of the MediaElement is changed, the state changes to Opening; if the Play method is called, nothing happens (no-op); if the Pause method is called, the state changes to Paused, and so on.
Note: |
|---|
Avoid "Not specified" states. For example, you should not call the Play method while the media is in the Opening state. To avoid this, you could check the CurrentState of the MediaElement before allowing Play to be called. |
The following notes pertain to scenarios from the previous table. Note that the scenario Buffering/Play corresponds to the MediaElement being in a state of Buffering, and then the Play method is called.
Buffering/Play: This scenario results in MediaElement going into the Playing state so that the user can leave the Buffering state sooner than the BufferingTime specifies.
Playing/Seek: This scenario results in Buffering to ensure that enough of the video stream has been downloaded.
[Paused or Stopped]/Play: This scenario results in Buffering to ensure that enough of the media file has been downloaded.