play(source, options = {}) {
        if(this.shared) {
            throw new Error("Cannot play stream on shared voice connection");
        }
        if(!this.ready) {
            throw new Error("Not ready yet");
        }

        options.format = options.format || null;
        options.voiceDataTimeout = !isNaN(options.voiceDataTimeout) ? options.voiceDataTimeout : 2000;
        options.inlineVolume = !!options.inlineVolume;
        options.inputArgs = options.inputArgs || [];
        options.encoderArgs = options.encoderArgs || [];

        options.samplingRate = options.samplingRate || this.samplingRate;
        options.frameDuration = options.frameDuration || this.frameDuration;
        options.frameSize = options.frameSize || options.samplingRate * options.frameDuration / 1000;
        options.pcmSize = options.pcmSize || options.frameSize * 2 * this.channels;

        if(!this.piper.encode(source, options)) {
            this.emit("error", new Error("Unable to encode source"));
            return;
        }

        this.ended = false;
        this.current = {
            startTime: 0, // later
            playTime: 0,
            pausedTimestamp: 0,
            pausedTime: 0,
            bufferingTicks: 0,
            options: options,
            timeout: null,
            buffer: null
        };

        this.playing = true;

        /**
        * Fired when the voice connection starts playing a stream
        * @event SharedStream#start
        */
        this.emit("start");

        this._send();
    }
/**
    * Play an audio or video resource. If playing from a non-opus resource, FFMPEG should be compiled with --enable-libopus for best performance. If playing from HTTPS, FFMPEG must be compiled with --enable-openssl
    * @arg {ReadableStream | String} resource The audio or video resource, either a ReadableStream, URL, or file path
    * @arg {Object} [options] Music options
    * @arg {Boolean} [options.inlineVolume=false] Whether to enable on-the-fly volume changing. Note that enabling this leads to increased CPU usage
    * @arg {Number} [options.voiceDataTimeout=2000] Timeout when waiting for voice data (-1 for no timeout)
    * @arg {Array<String>} [options.inputArgs] Additional input parameters to pass to ffmpeg/avconv (before -i)
    * @arg {Array<String>} [options.encoderArgs] Additional encoder parameters to pass to ffmpeg/avconv (after -i)
    * @arg {String} [options.format] The format of the resource. If null, FFmpeg will attempt to guess and play the format. Available options: "dca", "ogg", "webm", "pcm", null
    * @arg {Number} [options.frameDuration=20] The resource opus frame duration (required for DCA/Ogg)
    * @arg {Number} [options.frameSize=2880] The resource opus frame size
    * @arg {Number} [options.sampleRate=48000] The resource audio sampling rate
    */
Play an audio or video resource. If playing from a non-opus resource, FFMPEG should be compiled with --enable-libopus for best performance.
Play an audio or video resource . If playing from a non - opus resource FFMPEG should be compiled with -- enable - libopus for best performance .
play(source, options = {}) {
        if(this.shared) {
            throw new Error("Cannot play stream on shared voice connection");
        }
        if(!this.ready) {
            throw new Error("Not ready yet");
        }
        options.format = options.format || null;
        options.voiceDataTimeout = !isNaN(options.voiceDataTimeout) ? options.voiceDataTimeout : 2000;
        options.inlineVolume = !!options.inlineVolume;
        options.inputArgs = options.inputArgs || [];
        options.encoderArgs = options.encoderArgs || [];
        options.samplingRate = options.samplingRate || this.samplingRate;
        options.frameDuration = options.frameDuration || this.frameDuration;
        options.frameSize = options.frameSize || options.samplingRate * options.frameDuration / 1000;
        options.pcmSize = options.pcmSize || options.frameSize * 2 * this.channels;
        if(!this.piper.encode(source, options)) {
            this.emit("error", new Error("Unable to encode source"));
            return;
        }
        this.ended = false;
        this.current = {
            startTime: 0, 
            playTime: 0,
            pausedTimestamp: 0,
            pausedTime: 0,
            bufferingTicks: 0,
            options: options,
            timeout: null,
            buffer: null
        };
        this.playing = true;
        this.emit("start");
        this._send();
    }
play ( source , options = { } ) { if ( this . shared ) { throw new Error ( "Cannot play stream on shared voice connection" ) ; } if ( ! this . ready ) { throw new Error ( "Not ready yet" ) ; } options . format = options . format || null ; options . voiceDataTimeout = ! isNaN ( options . voiceDataTimeout ) ? options . voiceDataTimeout : 2000 ; options . inlineVolume = ! ! options . inlineVolume ; options . inputArgs = options . inputArgs || [ ] ; options . encoderArgs = options . encoderArgs || [ ] ; options . samplingRate = options . samplingRate || this . samplingRate ; options . frameDuration = options . frameDuration || this . frameDuration ; options . frameSize = options . frameSize || options . samplingRate * options . frameDuration / 1000 ; options . pcmSize = options . pcmSize || options . frameSize * 2 * this . channels ; if ( ! this . piper . encode ( source , options ) ) { this . emit ( "error" , new Error ( "Unable to encode source" ) ) ; return ; } this . ended = false ; this . current = { startTime : 0 , playTime : 0 , pausedTimestamp : 0 , pausedTime : 0 , bufferingTicks : 0 , options : options , timeout : null , buffer : null } ; this . playing = true ; this . emit ( "start" ) ; this . _send ( ) ; }
Play an audio or video resource.
Play an audio or video resource .
// later /**
        * Fired when the voice connection starts playing a stream
        * @event SharedStream#start
        */