Class: VoiceBroadcast

VoiceBroadcast

A voice broadcast can be played across multiple voice connections for improved shared-stream efficiency. Example usage: ```js const broadcast = client.voice.createBroadcast(); broadcast.play('./music.mp3'); // Play "music.mp3" in all voice connections that the client is in for (const connection of client.voice.connections.values()) { connection.play(broadcast); } ```

Constructor

new VoiceBroadcast()

Implements:
Source:

Extends

  • EventEmitter

Members

client :Client

The client that created the broadcast
Type:
Source:

(readonly, nullable) dispatcher :BroadcastDispatcher

The current master dispatcher, if any. This dispatcher controls all that is played by subscribed dispatchers.
Type:
Source:

subscribers :Array.<StreamDispatcher>

The subscribed StreamDispatchers of this broadcast
Type:
Source:

Methods

end()

Ends the broadcast, unsubscribing all subscribed channels and deleting the broadcast
Source:

play(resource, optionsopt) → {BroadcastDispatcher}

Play an audio resource.
Parameters:
Name Type Attributes Description
resource ReadableStream | string The resource to play.
options StreamOptions <optional>
The options to play.
Implements:
Source:
Returns:
Type
BroadcastDispatcher
Examples
// Play a local audio file
broadcast.play('/home/hydrabolt/audio.mp3', { volume: 0.5 });
// Play a ReadableStream
broadcast.play(ytdl('https://www.youtube.com/watch?v=ZlAU_w7-Xp8', { filter: 'audioonly' }));
// Using different protocols: https://ffmpeg.org/ffmpeg-protocols.html
broadcast.play('http://www.sample-videos.com/audio/mp3/wave.mp3');

Events

subscribe

Emitted whenever a stream dispatcher subscribes to the broadcast.
Parameters:
Name Type Description
subscriber StreamDispatcher The subscribed dispatcher
Source:

unsubscribe

Emitted whenever a stream dispatcher unsubscribes to the broadcast.
Parameters:
Name Type Description
dispatcher StreamDispatcher The unsubscribed dispatcher
Source: