本文整理汇总了C#中PlayState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PlayState.ToString方法的具体用法?C# PlayState.ToString怎么用?C# PlayState.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayState
的用法示例。
在下文中一共展示了PlayState.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPlayStateChanged
/// <summary>
/// Called when the playstate changes, except for the Error state (see OnError)
/// </summary>
/// <param name="player">The BackgroundAudioPlayer</param>
/// <param name="track">The track playing at the time the playstate changed</param>
/// <param name="playState">The new playstate of the player</param>
/// <remarks>
/// Play State changes cannot be cancelled. They are raised even if the application
/// caused the state change itself, assuming the application has opted-in to the callback.
///
/// Notable playstate events:
/// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
/// (b) TrackReady: an audio track has been set and it is now ready for playack.
///
/// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
/// </remarks>
protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
{
System.Diagnostics.Debug.WriteLine("AGENT PLAY STATE CHANGED: " + playState.ToString());
switch (playState)
{
case PlayState.TrackEnded:
player.Track = GetNextTrack();
break;
case PlayState.TrackReady:
player.Play();
break;
case PlayState.Shutdown:
SaveTrackAndTime(player, track);
break;
case PlayState.Unknown:
break;
case PlayState.Stopped:
break;
case PlayState.Paused:
break;
case PlayState.Playing:
break;
case PlayState.BufferingStarted:
break;
case PlayState.BufferingStopped:
break;
case PlayState.Rewinding:
break;
case PlayState.FastForwarding:
break;
}
NotifyComplete();
}