[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Called when the play state changes, except for the error state.
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)
Protected Overridable Sub OnPlayStateChanged ( _ player As BackgroundAudioPlayer, _ track As AudioTrack, _ playState As PlayState _ )
protected virtual void OnPlayStateChanged( BackgroundAudioPlayer player, AudioTrack track, PlayState playState )
The track playing at the time that the play state changed.
The new state of the player.
For changes in the error state, see OnError(BackgroundAudioPlayer, AudioTrack, Exception, Boolean).
Notifications of changes to the play state occur after the fact. They cannot be cancelled. They are raised even if the application caused the state change itself, assuming the application has opted-in to the callback.
When the Shutdown state occurs, your AudioPlayerAgent has two seconds to clean up its resources. This timer is not suppressed during debug sessions. This means that setting a breakpoint, or stepping through the code, after receiving notification of the Shutdown state may lead to unexpected behavior. The background audio service releases all resources two seconds after Shutdown is triggered.
If you don’t override the OnPlayStateChanged(BackgroundAudioPlayer, AudioTrack, PlayState) method, then it simply calls NotifyComplete()()().
This API is not supported for Silverlight 8.1 apps.
Windows Phone OS
Supported in: 8.1, 8.0, 7.1