当前位置: 首页>>代码示例>>C#>>正文


C# BackgroundAudioPlayer.FastForward方法代码示例

本文整理汇总了C#中BackgroundAudioPlayer.FastForward方法的典型用法代码示例。如果您正苦于以下问题:C# BackgroundAudioPlayer.FastForward方法的具体用法?C# BackgroundAudioPlayer.FastForward怎么用?C# BackgroundAudioPlayer.FastForward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BackgroundAudioPlayer的用法示例。


在下文中一共展示了BackgroundAudioPlayer.FastForward方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnUserAction

        /// <summary>
        ///     Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">
        ///     The data associated with the requested action.
        ///     In the current version this parameter is only for use with the Seek action,
        ///     to indicate the requested position of an audio track
        /// </param>
        /// <remarks>
        ///     User actions do not automatically make any changes in system state; the agent is responsible
        ///     for carrying out the user actions if they are supported.
        ///     Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            Debug.WriteLine("OnUserAction() action " + action);

            switch (action)
            {
                case UserAction.Play:
                    var task = Task.Run((Func<Task>)RunDownload);

                    if (player.PlayerState != PlayState.Playing)
                        player.Play();

                    task.ContinueWith(t => NotifyComplete());

                    return;
                case UserAction.Stop:
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    player.Track = GetNextTrack();
                    break;
                case UserAction.SkipPrevious:
                    var previousTrack = GetPreviousTrack();
                    if (previousTrack != null)
                        player.Track = previousTrack;
                    break;
            }

            NotifyComplete();
        }
开发者ID:henricj,项目名称:HttpClientBackgroundAudio,代码行数:58,代码来源:AudioPlayer.cs

示例2: OnUserAction

 /// <summary>
 /// Called when the user requests an action using application/system provided UI
 /// </summary>
 /// <param name="player">The BackgroundAudioPlayer</param>
 /// <param name="track">The track playing at the time of the user action</param>
 /// <param name="action">The action the user has requested</param>
 /// <param name="param">The data associated with the requested action.
 /// In the current version this parameter is only for use with the Seek action,
 /// to indicate the requested position of an audio track</param>
 /// <remarks>
 /// User actions do not automatically make any changes in system state; the agent is responsible
 /// for carrying out the user actions if they are supported.
 /// 
 /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
 /// </remarks>
 protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
 {
     switch (action)
     {
         case UserAction.Play:
             var audioInfo = (from audio in db.AudioPlaylist
                              select audio).FirstOrDefault();
             string audioUrl = audioInfo.AudioUrl;
             string audioTitle = audioInfo.AudioTitle;
             string audioArtist = audioInfo.AudioArtist;
             string audioId = audioInfo.Aid;
             player.Track = new AudioTrack(new Uri(audioUrl), audioTitle, audioArtist, null, null, audioId, EnabledPlayerControls.All);
             if (player.PlayerState != PlayState.Playing)
             {
                 player.Play();
             }
             break;
         case UserAction.Stop:
             player.Stop();
             break;
         case UserAction.Pause:
             player.Pause();
             break;
         case UserAction.FastForward:
             player.FastForward();
             break;
         case UserAction.Rewind:
             player.Rewind();
             break;
         case UserAction.Seek:
             player.Position = (TimeSpan)param;
             break;
         case UserAction.SkipNext:
             player.Track = GetNextTrack();
             break;
         case UserAction.SkipPrevious:
             AudioTrack previousTrack = GetPreviousTrack();
             if (previousTrack != null)
             {
                 player.Track = previousTrack;
             }
             break;
     }
     NotifyComplete();
 }
开发者ID:mikejan,项目名称:EntacikGorc,代码行数:60,代码来源:AudioPlayer.cs

示例3: OnUserAction

 /// <summary>
 /// Called when the user requests an action using application/system provided UI
 /// </summary>
 /// <param name="player">The BackgroundAudioPlayer</param>
 /// <param name="track">The track playing at the time of the user action</param>
 /// <param name="action">The action the user has requested</param>
 /// <param name="param">The data associated with the requested action.
 /// In the current version this parameter is only for use with the Seek action,
 /// to indicate the requested position of an audio track</param>
 /// <remarks>
 /// User actions do not automatically make any changes in system state; the agent is responsible
 /// for carrying out the user actions if they are supported.
 /// 
 /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
 /// </remarks>
 protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
 {
     switch (action)
     {
         case UserAction.Play:
             if (player != null && player.PlayerState != PlayState.Playing)
             {
                 player.Volume = 1;
                 player.Play();
             }
             break;
         case UserAction.Stop:
             player.Stop();
             break;
         case UserAction.Pause:
             player.Pause();
             break;
         case UserAction.FastForward:
             player.FastForward();
             break;
         case UserAction.Rewind:
             player.Rewind();
             break;
         case UserAction.Seek:
             player.Position = (TimeSpan)param;
             break;
         case UserAction.SkipNext:
             SetNextTrack(player);
             break;
         case UserAction.SkipPrevious:
             SetPreviousTrack(player);
             break;
     }
     NotifyComplete();
 }
开发者ID:rlecole,项目名称:SaveAndPlay,代码行数:50,代码来源:AudioPlayer.cs

示例4: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    PlayTrack(player);
                    break;
                case UserAction.Stop:
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
             //   case UserAction.SkipNext:
               //     PlayNextTrack(player);
                 //   break;
                //case UserAction.SkipPrevious:
                  //  PlayPreviousTrack(player);
                    //break;
            }

            NotifyComplete();
        }
开发者ID:amiit,项目名称:Audio_Aarti,代码行数:47,代码来源:AudioPlayer.cs

示例5: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    //if (player.PlayerState != PlayState.Playing)
                    //{
                        // to get audio track
                        //player.Track = this.audioTrack;
                        //player.Play();
                    //}
                    if (player.Track == null)
                    {
                        currentTrack = 0;
                        player.Track = playlist[currentTrack];
                    }
                    else
                    {
                        player.Play();
                    }
                    break;
                case UserAction.Stop:
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    //player.Track = GetNextTrack();
                    if (currentTrack < playlist.Count - 1)
                    {
                        currentTrack += 1;
                        player.Track = playlist[currentTrack];
                    }
                    else
                    {
                        player.Track = null;
                    }
                    break;
                case UserAction.SkipPrevious:
                    //AudioTrack previousTrack = GetPreviousTrack();
                    //if (previousTrack != null)
                    //{
                        //player.Track = previousTrack;
                    //}
                    break;
            }

            NotifyComplete();
        }
开发者ID:dinesh2043,项目名称:Audiobook,代码行数:74,代码来源:AudioPlayer.cs

示例6: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    if (PlayState.Playing != player.PlayerState)
                    {
                        player.Track = _playList[currentTrackNumber];
                    }
                    break;

                case UserAction.Stop:
                    player.Stop();
                    break;

                case UserAction.Pause:
                    if (PlayState.Playing == player.PlayerState)
                    {
                        player.Pause();
                    }
                    break;

                case UserAction.FastForward:
                    // Fast Forward only works with non-MSS clients.
                    // If the Source is null, we are streaming an MSS.
                    if (track.Source != null)
                    {
                        player.FastForward();
                    }
                    break;

                case UserAction.Rewind:
                    // Rewind only works with non-MSS clients.
                    // If the Source is null, we are streaming an MSS.
                    if (track.Source != null)
                    {
                        player.Rewind();
                    }
                    break;

                case UserAction.Seek:
                    // Seek only works with non-MSS clients.
                    // If the Source is null, we are streaming an MSS.
                    if (track.Source != null)
                    {
                        player.Position = (TimeSpan)param;
                    }
                    break;

                case UserAction.SkipNext:
                    player.Track = GetNextTrack();
                    break;

                case UserAction.SkipPrevious:
                    player.Track = GetPreviousTrack();
                    break;
            }

            NotifyComplete();
        }
开发者ID:avi-,项目名称:bingo,代码行数:75,代码来源:AudioPlayer.cs

示例7: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected async override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    if (player.PlayerState != PlayState.Playing)
                    {
                        player.Play();
                    }
                    break;
                case UserAction.Stop:
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    {
                        AudioTrack newTrack = await GetNextStation(player.Track.Artist);
                        if (track != null)
                            player.Track = newTrack;
                        break;
                    }
                case UserAction.SkipPrevious:
                    {
                        AudioTrack newTrack = await GetPreviousStation(player.Track.Artist);
                        if (track != null)
                            player.Track = newTrack;
                        break;
                    }
            }

            NotifyComplete();
        }
开发者ID:NickCulbertson,项目名称:beem,代码行数:58,代码来源:AudioPlayer.cs

示例8: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        ///
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            this.Log("OnUserAction called, action: " + action);
            switch (action)
            {
                case UserAction.Play:
                    if (player.PlayerState != PlayState.Playing)
                    {
                        player.Play();
                    }
                    break;
                case UserAction.Stop:
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    player.Track = GetNextTrack();
                    break;
                case UserAction.SkipPrevious:
                    AudioTrack previousTrack = GetPreviousTrack();
                    if (previousTrack != null)
                    {
                        player.Track = previousTrack;
                    }
                    break;
            }

            NotifyComplete();
        }
开发者ID:journeyman,项目名称:PodcastReader,代码行数:55,代码来源:AudioQueueScheduler.cs

示例9: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            System.Diagnostics.Debug.WriteLine("AGENT RECEIVED USER ACTION: " + action.ToString());
            switch (action)
            {
                case UserAction.Play:
                    PlayTrack(player);
                    break;
                case UserAction.Stop:
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    player.Track = GetNextTrack();
                    break;
                case UserAction.SkipPrevious:
                    AudioTrack previousTrack = GetPreviousTrack();
                    if (previousTrack != null)
                    {
                        player.Track = previousTrack;
                    }
                    break;
            }

            NotifyComplete();
        }
开发者ID:dharmababa,项目名称:35ConfessionBuddhas,代码行数:52,代码来源:AudioPlayer.cs

示例10: OnUserAction

        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    PlayTrack(player);
                    break;

                case UserAction.Pause:
                    try
                    {
                        if (player.CanPause)
                        {
                            player.Pause();
                        }
                    }
                    catch (UnauthorizedAccessException ex)
                    {
                        // what the fuck??
                    }
                    break;

                case UserAction.SkipPrevious:
                    PlayPreviousTrack(player);
                    break;

                case UserAction.SkipNext:
                    PlayNextTrack(player);
                    break;

                case UserAction.Stop:
                    player.Stop();
                    break;

                case UserAction.FastForward:
                    player.FastForward();
                    break;

                case UserAction.Rewind:
                    player.Rewind();
                    break;

                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
            }

            NotifyComplete();
        }
开发者ID:lonkly,项目名称:StereomoodWP7,代码行数:49,代码来源:AudioPlayer.cs

示例11: OnUserAction

        /// <summary>
        ///     Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">
        ///     The data associated with the requested action.
        ///     In the current version this parameter is only for use with the Seek action,
        ///     to indicate the requested position of an audio track
        /// </param>
        /// <remarks>
        ///     User actions do not automatically make any changes in system state; the agent is responsible
        ///     for carrying out the user actions if they are supported.
        ///     Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            Debug.WriteLine("AudioPlayer.OnUserAction() track.Source {0} track.Tag {1} action {2}",
                null == track ? "<no track>" : null == track.Source ? "<none>" : track.Source.ToString(),
                null == track ? "<no track>" : track.Tag ?? "<none>", action);

            try
            {
                switch (action)
                {
                    case UserAction.Play:
                        UpdateTrack(player);

                        if (PlayState.Playing != player.PlayerState && null != player.Track)
                            player.Play();

                        break;
                    case UserAction.Stop:
                        player.Stop();

                        break;
                    case UserAction.Pause:
                        if (PlayState.Playing == player.PlayerState)
                            player.Pause();

                        break;
                    case UserAction.FastForward:
                        if (null != track && null != track.Source)
                            player.FastForward();

                        break;
                    case UserAction.Rewind:
                        if (null != track && null != track.Source)
                            player.Rewind();

                        break;
                    case UserAction.Seek:
                        if (null != track)
                            player.Position = (TimeSpan)param;

                        break;
                    case UserAction.SkipNext:
                        player.Track = GetNextTrack();

                        if (PlayState.Playing != player.PlayerState && null != player.Track)
                            player.Play();

                        break;
                    case UserAction.SkipPrevious:
                        var previousTrack = GetPreviousTrack();
                        if (previousTrack != null)
                            player.Track = previousTrack;

                        if (PlayState.Playing != player.PlayerState && null != player.Track)
                            player.Play();

                        break;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("AudioPlayer.OnUserAction() failed: " + ex.ExtendedMessage());

                // Is there anything we can do about this?
                try
                {
                    player.Close();
                }
                catch (Exception ex2)
                {
                    Debug.WriteLine("AudioPlayer.OnUserAction() close failed: " + ex2.ExtendedMessage());
                }
            }
            finally
            {
                NotifyComplete();
            }
        }
开发者ID:henricj,项目名称:phonesm,代码行数:94,代码来源:AudioPlayer.cs

示例12: OnUserAction

        /// <summary>
        /// Called when the user requests an action using system-provided UI and the application has requesed
        /// notifications of the action
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.Play:
                    if (player.PlayerState == PlayState.Paused)
                    {
                        player.Play();
                    }
                    else
                    {
                        Play(player);
                    }
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    PlayNext(player);
                    break;
                case UserAction.SkipPrevious:
                    PlayPrev(player);
                    break;
                case UserAction.Stop:
                    player.Stop();
                    break;
                default:
                    break;
            }

            NotifyComplete();
        }
开发者ID:Vykt0r,项目名称:Music-Player,代码行数:55,代码来源:AudioPlayer.cs

示例13: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    PlayTrack(player);
                    break;
                case UserAction.Stop:
                    PlayTrack(player);
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    player.Track = GetNextTrack();
                    break;
                case UserAction.SkipPrevious:
                    AudioTrack previousTrack = GetPreviousTrack();
                    if (previousTrack != null)
                    {
                        player.Track = previousTrack;
                    }
                    break;
            }

            NotifyComplete();
        }
开发者ID:PeerAS,项目名称:Assignment_1,代码行数:51,代码来源:AudioPlayer.cs

示例14: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override async void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            await ConfigureThePlayer();
            switch (action)
            {
                case UserAction.Play:
                    if (player.PlayerState != PlayState.Playing)
                    {
                        _logger.Info("OnUserAction.Play");
                        player.Play();
                    }
                    break;
                case UserAction.Stop:
                    _logger.Info("OnUserAction.Stop");
                    player.Stop();
                    break;
                case UserAction.Pause:
                    _logger.Info("OnUserAction.Pause");
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    _logger.Info("OnUserAction.FastForward");
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    _logger.Info("OnUserAction.Rewind");
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    _logger.Info("OnUserAction.SkipNext");
                    var nextTrack = await GetNextTrack();
                    if (nextTrack != null)
                    {
                        player.Track = nextTrack;
                    }
                    await InformOfPlayingTrack();
                    break;
                case UserAction.SkipPrevious:
                    _logger.Info("OnUserAction.SkipPrevious");
                    var previousTrack = await GetPreviousTrack();
                    if (previousTrack != null)
                    {
                        player.Track = previousTrack;
                    }
                    await InformOfPlayingTrack();
                    break;
            }

            NotifyComplete();
        }
开发者ID:timextreasures,项目名称:Emby.WindowsPhone,代码行数:68,代码来源:AudioPlayer.cs

示例15: OnUserAction

        /// <summary>
        /// Called when the user requests an action using application/system provided UI
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time of the user action</param>
        /// <param name="action">The action the user has requested</param>
        /// <param name="param">The data associated with the requested action.
        /// In the current version this parameter is only for use with the Seek action,
        /// to indicate the requested position of an audio track</param>
        /// <remarks>
        /// User actions do not automatically make any changes in system state; the agent is responsible
        /// for carrying out the user actions if they are supported.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    if (player.PlayerState == PlayState.Paused)
                        PopulatePlaylist(false);
                    else
                        PopulatePlaylist(true);
                    if (currentPlaylist != null && currentPlaylist.Count > 0)
                    {
                        player.Track = currentPlaylist[currentTrackNumber];
                    }
                    break;
                case UserAction.Stop:
                    currentPlaylist = null;
                    currentTrackNumber = 0;
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    if (currentPlaylist != null && currentPlaylist.Count > 0)
                        player.Track = GetNextTrack();
                    break;
                case UserAction.SkipPrevious:
                    if (currentPlaylist != null && currentPlaylist.Count > 0)
                        player.Track = GetPreviousTrack();
                    break;
            }

            NotifyComplete();
        }
开发者ID:ahmeda8,项目名称:audio-youtube-wp7,代码行数:58,代码来源:AudioPlayer.cs


注:本文中的BackgroundAudioPlayer.FastForward方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。