CloseMedia Method

MediaStreamSource.CloseMedia Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

The MediaElement can call this method when going through normal shutdown or as a result of an error. This lets the developer perform any needed cleanup of the MediaStreamSource.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

'Declaration
Protected MustOverride Sub CloseMedia

Removing a MediaElement from the UI tree will trigger a state transition to Closed. However, the CloseMedia method is not guaranteed to be called in this case. To ensure CloseMedia is called, set the MediaElement.Source property to Nothing prior to detaching it from the UI tree.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft