Skip to content

VideoDispatcher ​

classe · Source

The class that sends video packet data to the voice connection.

js
// Obtained using:
client.voice.joinChannel(channel).then(connection => {
  // You can play a file or a stream here:
  const dispatcher = connection.playVideo('/home/hydrabolt/video.mp4', { fps: 60, preset: 'ultrafast' });
});

Extends: BaseDispatcher

Properties ​

fps ​

fps: number

Video FPS Source

player ​

player: MediaPlayer

The Player that controls this dispatcher Source

pausedSince ​

nullable

pausedSince: number

The time that the stream was paused at (null if not paused) Source

paused ​

readonly

paused: boolean

Whether or not playback is paused Source

pausedTime ​

readonly

pausedTime: number

Total time that this dispatcher has been paused in milliseconds Source

totalStreamTime ​

readonly

totalStreamTime: number

The time (in milliseconds) that the dispatcher has been playing audio for, taking into account skips and pauses Source

Methods ​

getTypeDispatcher ​

getTypeDispatcher(): 'video'

Get the type of the dispatcher Returns: 'video'Source

setFPSSource ​

setFPSSource(value: number)

Set FPS Parameters

NameTypeDescription
valuenumberfps
Source

pause ​

pause(silence?: boolean)

Pauses playback Parameters

NameTypeDescription
silence?booleanWhether to play silence while paused to prevent audio glitches Default: false.
Source

resume ​

resume()

Resumes playback Source

createHeaderExtension ​

createHeaderExtension(): Buffer

Creates a one-byte extension header https://www.rfc-editor.org/rfc/rfc5285#section-4.2Returns: Buffer — <Buffer be de 00 01> Source

createPayloadExtension ​

createPayloadExtension(): Buffer

Creates a one-byte extension header & a single extension of type playout-delay Returns: Buffer — playout-delay extension <Buffer 51 00 00 00> Source

Events ​

videoStatus ​

videoStatus: unknown

Emitted when the dispatcher starts/stops video. Parameters

NameTypeDescription
valuebooleanWhether or not the dispatcher is enable video
Source

streamStatus ​

streamStatus: unknown

Emitted when the dispatcher starts/stops video. Parameters

NameTypeDescription
isPausedbooleanWhether or not the dispatcher is pause video
Source

error ​

error: unknown

Emitted when the dispatcher encounters an error. Source

start ​

start: unknown

Emitted once the stream has started to play. Source

debug ​

debug: unknown

Emitted whenever the dispatcher has debug information. Parameters

NameTypeDescription
infostringThe debug info
Source

Unofficial software. Not affiliated with or supported by Discord.