javazoom.jl.player.Player.close C# (CSharp) Method

close() public method

Cloases this player. Any audio currently playing is stopped immediately.
public close ( ) : void
return void
        public virtual void close()
        {
            lock (this)
            {
                AudioDevice out_Renamed = audio;
                if (out_Renamed != null)
                {
                    closed = true;
                    audio = null;
                    // this may fail, so ensure object state is set up before
                    // calling this method.
                    out_Renamed.close();
                    lastPosition = out_Renamed.Position;
                    try
                    {
                        bitstream.close();
                    }
                    catch (BitstreamException ex)
                    {
                    }
                }
            }
        }

Usage Example

Ejemplo n.º 1
0
 /// <summary> Stops the audio player. If the player is already stopped
 /// this method is a no-op.
 /// </summary>
 protected internal virtual void  stopPlayer()
 {
     if (player != null)
     {
         player.close();
         player       = null;
         playerThread = null;
     }
 }