Skip to content

Commit

Permalink
voice: reimplement seek option (#2572)
Browse files Browse the repository at this point in the history
  • Loading branch information
amishshah committed Jun 13, 2018
1 parent 04618f5 commit 1cdee7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/client/voice/player/BasePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class BasePlayer extends EventEmitter {
this.destroyDispatcher();

const isStream = input instanceof ReadableStream;

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 streams = { ffmpeg };
if (isStream) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/voice/util/PlayInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { Error } = require('../../../errors');
* Options that can be passed to stream-playing methods:
* @typedef {Object} StreamOptions
* @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
* this stream to improve performance.
* @property {number} [passes=1] How many times to send the voice packet to reduce packet loss
Expand Down

0 comments on commit 1cdee7b

Please sign in to comment.