mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
voice: reimplement seek option (#2572)
This commit is contained in:
@@ -44,7 +44,10 @@ class BasePlayer extends EventEmitter {
|
|||||||
this.destroyDispatcher();
|
this.destroyDispatcher();
|
||||||
|
|
||||||
const isStream = input instanceof ReadableStream;
|
const isStream = input instanceof ReadableStream;
|
||||||
|
|
||||||
const args = isStream ? FFMPEG_ARGUMENTS : ['-i', input, ...FFMPEG_ARGUMENTS];
|
const args = isStream ? FFMPEG_ARGUMENTS : ['-i', input, ...FFMPEG_ARGUMENTS];
|
||||||
|
if (options.seek) args.push('-ss', String(options.seek));
|
||||||
|
|
||||||
const ffmpeg = new prism.FFmpeg({ args });
|
const ffmpeg = new prism.FFmpeg({ args });
|
||||||
const streams = { ffmpeg };
|
const streams = { ffmpeg };
|
||||||
if (isStream) {
|
if (isStream) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const { Error } = require('../../../errors');
|
|||||||
* Options that can be passed to stream-playing methods:
|
* Options that can be passed to stream-playing methods:
|
||||||
* @typedef {Object} StreamOptions
|
* @typedef {Object} StreamOptions
|
||||||
* @property {StreamType} [type='unknown'] The type of stream.
|
* @property {StreamType} [type='unknown'] The type of stream.
|
||||||
* @property {number} [seek=0] The time to seek to
|
* @property {number} [seek=0] The time to seek to, will be ignored when playing `ogg/opus` or `webm/opus` streams
|
||||||
* @property {number|boolean} [volume=1] The volume to play at. Set this to false to disable volume transforms for
|
* @property {number|boolean} [volume=1] The volume to play at. Set this to false to disable volume transforms for
|
||||||
* this stream to improve performance.
|
* this stream to improve performance.
|
||||||
* @property {number} [passes=1] How many times to send the voice packet to reduce packet loss
|
* @property {number} [passes=1] How many times to send the voice packet to reduce packet loss
|
||||||
|
|||||||
Reference in New Issue
Block a user