MediaStreamSource.CloseMedia Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Protected MustOverride Sub CloseMedia
protected abstract void CloseMedia()

Remarks

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 nulla null reference (Nothing in Visual Basic) prior to detaching it from the UI tree.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.