wpf_player.ObservableStream.WaitForMore C# (CSharp) Method

WaitForMore() public method

Sets the waiting state for the stream and sets the position waited.
public WaitForMore ( int how_many = 15000 ) : void
how_many int Number of bytes needed. Default is 15000
return void
        public void WaitForMore(int how_many = 15000)
        {
            waiting = true;
            positionWaited = Math.Min(Position + how_many,Length);
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// This callback is called everytime a sample is player. This method handles current time and current position updates,
        /// the stop of the playing at the end of the track and the buffering state.
        /// </summary>
        /// <param name="sender">Unused params</param>
        /// <param name="e">Unused params</param>
        private void wc_Sample(object sender, SampleEventArgs e)
        {
            if (wc == null)
            {
                return;
            }
            if (wc.CurrentTime.TotalSeconds != currentTime)
            {
                currentTime = wc.CurrentTime.TotalSeconds;
                NotifyPropertyChanged("CurrentTime");
                NotifyPropertyChanged("BufferPortion");
                pos = lmem.Position;
                NotifyPropertyChanged("Position");
            }
            if (lmem.Position == lmem.Length)
            {
                this.stop(); return;
            }
            long myBufferSize = 20480;

            if ((!BufferingState) && (localstream.Position != rsc.Tag.FileSize) && ((localstream.Position - lmem.Position) < myBufferSize))
            {
                Console.WriteLine("Paused ... waiting!");
                BufferingState = true;
                this.pause();
                localstream.WaitForMore();
            }
        }
All Usage Examples Of wpf_player.ObservableStream::WaitForMore