func NewPlayer(context *Context, src io.ReadCloser) (*Player, error) {
	p := &Player{
		&playerImpl{
			context:    context,
			src:        src,
			sampleRate: context.sampleRate,
			volume:     1,
		},
	}
	if seeker, ok := p.p.src.(io.Seeker); ok {
		// Get the current position of the source.
		pos, err := seeker.Seek(0, io.SeekCurrent)
		if err != nil {
			return nil, err
		}
		p.p.pos = pos
	}
	runtime.SetFinalizer(p, (*Player).finalize)

	return p, nil
}
func NewPlayer(context *Context, src io.ReadCloser) (*Player, error) {
	p := &Player{
		&playerImpl{
			context:    context,
			src:        src,
			sampleRate: context.sampleRate,
			volume:     1,
		},
	}
	if seeker, ok := p.p.src.(io.Seeker); ok {
		// Get the current position of the source.
		pos, err := seeker.Seek(0, io.SeekCurrent)
		if err != nil {
			return nil, err
		}
		p.p.pos = pos
	}
	runtime.SetFinalizer(p, (*Player).finalize)

	return p, nil
}
// NewPlayer creates a new player with the given stream.
//
// src's format must be linear PCM (16bits little endian, 2 channel stereo)
// without a header (e.g. RIFF header).
// The sample rate must be same as that of the audio context.
//
// The player is seekable when src is io.Seeker.
// Attempt to seek the player that is not io.Seeker causes panic.
//
// Note that the given src can't be shared with other Player objects.
//
// NewPlayer tries to call Seek of src to get the current position.
// NewPlayer returns error when the Seek returns error.
//
// NewPlayer takes the ownership of src. Player's Close calls src's Close.