Esempio n. 1
0
        /// <summary>
        /// Changes the position of the playing stream.
        /// Invokes "VoiceStreamPositionSought" to other application's modules.
        /// </summary>
        /// <param name="factor">Decides whether the stream is fast-forwarded or rewinded.</param>
        public void SeekVoiceStreamPosition(int factor)
        {
            try
            {
                int nextPosition = _player.GetPlayPosition() + factor * LENGTH_TO_SKIP;

                if (nextPosition >= _player.StreamInfo.GetDuration())
                {
                    OnPlaybackCompleted(this, new EventArgs());
                    return;
                }

                if (nextPosition < 0)
                {
                    nextPosition = 0;
                }

                _player.SetPlayPositionAsync(nextPosition, false);
            }
            catch (Exception exception)
            {
                ErrorHandler(exception.Message);
                return;
            }

            VoiceStreamPositionSought?.Invoke(this, new EventArgs());
        }
 /// <summary>
 /// Handles "VoiceStreamPositionSought" of the IVoicePlayerService object.
 /// Invokes "VoiceStreamPositionSought" to other application's modules.
 /// </summary>
 /// <param name="sender">Instance of the VoicePlayerService class.</param>
 /// <param name="e">Contains event data.</param>
 private void VoiceStreamPositionSoughtEventHandler(object sender, EventArgs e)
 {
     VoiceStreamPositionSought?.Invoke(this, new EventArgs());
 }