public function playRawStream($stream, $channels = 2)
    {
        $deferred = new Deferred();

        if (! $this->ready) {
            $deferred->reject(new \Exception('Voice Client is not ready.'));

            return $deferred->promise();
        }

        if (! is_resource($stream) && ! $stream instanceof Stream) {
            $deferred->reject(new \RuntimeException('The stream passed to playRawStream was not an instance of resource or ReactPHP Stream.'));

            return $deferred->promise();
        }

        if (is_resource($stream)) {
            $stream = new Stream($stream, $this->loop);
        }

        $process = $this->dcaEncode('', $channels);
        $process->start($this->loop);

        $stream->pipe($process->stdin);

        return $this->playDCAStream($process);
    }
public function playRawStream($stream, $channels = 2)
    {
        $deferred = new Deferred();

        if (! $this->ready) {
            $deferred->reject(new \Exception('Voice Client is not ready.'));

            return $deferred->promise();
        }

        if (! is_resource($stream) && ! $stream instanceof Stream) {
            $deferred->reject(new \RuntimeException('The stream passed to playRawStream was not an instance of resource or ReactPHP Stream.'));

            return $deferred->promise();
        }

        if (is_resource($stream)) {
            $stream = new Stream($stream, $this->loop);
        }

        $process = $this->dcaEncode('', $channels);
        $process->start($this->loop);

        $stream->pipe($process->stdin);

        return $this->playDCAStream($process);
    }
public function playRawStream ( $ stream , $ channels = 2 ) { $ deferred = new Deferred ( ) ; if ( ! $ this -> ready ) { $ deferred -> reject ( new \ Exception ( 'Voice Client is not ready.' ) ) ; return $ deferred -> promise ( ) ; } if ( ! is_resource ( $ stream ) && ! $ stream instanceof Stream ) { $ deferred -> reject ( new \ RuntimeException ( 'The stream passed to playRawStream was not an instance of resource or ReactPHP Stream.' ) ) ; return $ deferred -> promise ( ) ; } if ( is_resource ( $ stream ) ) { $ stream = new Stream ( $ stream , $ this -> loop ) ; } $ process = $ this -> dcaEncode ( '' , $ channels ) ; $ process -> start ( $ this -> loop ) ; $ stream -> pipe ( $ process -> stdin ) ; return $ this -> playDCAStream ( $ process ) ; }
Plays a raw PCM16 stream.

@param resource|Stream $stream   The stream to be encoded and sent.
@param int             $channels How many audio channels to encode with.

@throws \RuntimeException Thrown when the stream passed to playRawStream is not a valid resource.

@return \React\Promise\Promise
Plays a raw PCM16 stream .