MediaHistory.NowPlaying Property

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

Gets the most recent MediaHistoryItem in the media history, or sets the supplied MediaHistoryItem into the Now Playing section of the Music + Videos Hub.

Namespace: Microsoft.Devices
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)

Syntax

Public Property NowPlaying As MediaHistoryItem
public MediaHistoryItem NowPlaying { get; set; }

Property Value

Type: Microsoft.Devices..::.MediaHistoryItem
Returns MediaHistoryItem.

Remarks

When setting this property, the supplied MediaHistoryItem cannot be null.

When getting this property, only the most recent MediaHistoryItem set by your application is returned. For example, if the user has played a more recent MediaHistoryItem through a different application, that item will not be returned with this property. Instead, the most recent item set by your own application is returned.

You must wait until the media stream has been opened before setting the NowPlaying property; otherwise, your data could be silently discarded. Applications MediaElement, wait for the MediaOpened event before setting NowPlaying. For applications using the XNA Game Studio MediaPlayer APIs, wait until the MediaStateChanged event is raised and the State property returns Playing. For applications using BackgroundAudioPlayer, there is no need to set the NowPlaying information because it is handled by the system automatically.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

MediaHistory Class

Microsoft.Devices Namespace