AudioResource
Represents an audio resource that can be played by an audio player.
AudioResource
Represents an audio resource that can be played by an audio player.
Parameter | Type | Optional |
---|---|---|
edges | readonly Array<Edge> | ❌ |
streams | readonly Array<Readable> | ❌ |
metadata | Metadata | ❌ |
silencePaddingFrames | number | ❌ |
Properties
public audioPlayer: any
The audio player that the resource is subscribed to, if any.
public edges: any
The pipeline used to convert the input stream into a playable format. For example, this may contain an FFmpeg component for arbitrary inputs, and it may contain a VolumeTransformer component for resources with inline volume transformation enabled.
public encoder: any
If using an Opus encoder to create this audio resource, then this will be a prism-media opus.Encoder. You can use this to control settings such as bitrate, FEC, PLP.
public metadata: any
Optional metadata that can be used to identify the resource.
public playStream: any
An object-mode Readable stream that emits Opus packets. This is what is played by audio players.
public playbackDuration: any
The playback duration of this audio resource, given in milliseconds.
public silencePaddingFrames: any
The number of silence frames to append to the end of the resource's audio stream, to prevent interpolation glitches.
public silenceRemaining: any
The number of remaining silence frames to play. If -1, the frames have not yet started playing.
public started: any
Whether or not the stream for this resource has started (data has become readable)
public volume: any
If the resource was created with inline volume transformation enabled, then this will be a prism-media VolumeTransformer. You can use this to alter the volume of the stream.
public ended: any
Whether this resource has ended or not.
public readable: any
Whether this resource is readable. If the underlying resource is no longer readable, this will still return true while there are silence padding frames left to play.
Methods
public read(): null | Buffer
Attempts to read an Opus packet from the audio resource. If a packet is available, the playbackDuration is incremented.