private void SeekTo(int seek)
        {
            try
            {
                int totalDuration   = Constant.MediaPlayer.Duration;
                int currentPosition = MusicUtils.ProgressToTimer(seek, totalDuration);

                // forward or backward to certain seconds
                Constant.MediaPlayer.SeekTo(currentPosition);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #2
0
        private void SeekTo(long seek)
        {
            try
            {
                var totalDuration   = Constant.Player.Duration;
                var currentPosition = MusicUtils.ProgressToTimer(seek, totalDuration);

                // forward or backward to certain seconds
                Constant.Player.SeekTo(currentPosition);

                GlobalContext?.SoundController?.SeekUpdate();

                if (Constant.IsPlayed && !Constant.Player.PlayWhenReady)
                {
                    Constant.Player.PlayWhenReady = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }