Media Session Events
Most of the Media Session's operations are performed asynchronously, so the application must listen for events by using the Media Session's IMFMediaEventGenerator interface. (The IMFMediaSession interface inherits IMFMediaEventGenerator.) The exact sequence of events will depend on your application, but the following events are raised by the Media Session in almost any situation.
|MEEndOfPresentation||Raised when the media source has completed the presentation. Data might still be moving through the pipeline at this time.|
|MEError||Raised if an error occurs during streaming.|
|MESessionClosed||Raised when the Close method completes. This event is the last event that the Media Session queues. After you receive this event, it is safe to shut down any media sources that you created.|
|MESessionEnded||Raised when the Media Session is done with the last presentation.|
|MESessionNotifyPresentationTime||Notifies the application of the presentation time when the new presentation will start.|
|MESessionStarted||Raised when the Start method completes. Unless an error occurred, data is moving through the pipeline at this point.|
|MESessionTopologySet||Raised when the SetTopology method completes. Unless an error occurs, the application does not need to take any action.|
|MESessionTopologyStatus||Raised at various times when the status of a topology changes.|
The IMFMediaSession::Shutdown method does not raise an event. The Shutdown method is synchronous. After this method returns, it is safe to release your event callback pointer.
In addition to events from the Media Session, the application might receive events from the media sinks in the topology. These can be custom events defined by the media sink, which might contain arbitrary data. For example, the sink might derive the event data from the source data, which can be from an untrusted external source. An application should ignore any events that it does not recognize, and exercise caution when parsing event data.