fix: live content
This commit is contained in:
parent
b51f30f1aa
commit
bfed268e7a
2 changed files with 9 additions and 4 deletions
|
@ -392,7 +392,8 @@ export class Player extends EventEmitter {
|
||||||
views: parseInt(info.videoDetails.viewCount),
|
views: parseInt(info.videoDetails.viewCount),
|
||||||
requestedBy: message.author,
|
requestedBy: message.author,
|
||||||
fromPlaylist: false,
|
fromPlaylist: false,
|
||||||
source: 'youtube'
|
source: 'youtube',
|
||||||
|
live: Boolean(info.videoDetails.isLiveContent)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
for (const [_, extractor] of this.Extractors) {
|
for (const [_, extractor] of this.Extractors) {
|
||||||
|
@ -999,7 +1000,11 @@ export class Player extends EventEmitter {
|
||||||
|
|
||||||
const info = oldTrack.raw.source === 'youtube' ? await ytdl.getInfo(oldTrack.url).catch((e) => {}) : null;
|
const info = oldTrack.raw.source === 'youtube' ? await ytdl.getInfo(oldTrack.url).catch((e) => {}) : null;
|
||||||
if (info) {
|
if (info) {
|
||||||
const res = await Util.ytSearch(info.related_videos[0].title, { player: this, limit: 1, user: oldTrack.requestedBy })
|
const res = await Util.ytSearch(info.related_videos[0].title, {
|
||||||
|
player: this,
|
||||||
|
limit: 1,
|
||||||
|
user: oldTrack.requestedBy
|
||||||
|
})
|
||||||
.then((v) => v[0])
|
.then((v) => v[0])
|
||||||
.catch((e) => {});
|
.catch((e) => {});
|
||||||
|
|
||||||
|
@ -1054,9 +1059,8 @@ export class Player extends EventEmitter {
|
||||||
let newStream: any;
|
let newStream: any;
|
||||||
if (queue.playing.raw.source === 'youtube') {
|
if (queue.playing.raw.source === 'youtube') {
|
||||||
newStream = ytdl(queue.playing.url, {
|
newStream = ytdl(queue.playing.url, {
|
||||||
filter: 'audioonly',
|
|
||||||
opusEncoded: true,
|
opusEncoded: true,
|
||||||
encoderArgs,
|
encoderArgs: queue.playing.raw.live ? [] : encoderArgs,
|
||||||
seek: seekTime / 1000,
|
seek: seekTime / 1000,
|
||||||
// tslint:disable-next-line:no-bitwise
|
// tslint:disable-next-line:no-bitwise
|
||||||
highWaterMark: 1 << 25,
|
highWaterMark: 1 << 25,
|
||||||
|
|
|
@ -30,6 +30,7 @@ export interface TrackData {
|
||||||
fromPlaylist: boolean;
|
fromPlaylist: boolean;
|
||||||
source?: TrackSource;
|
source?: TrackSource;
|
||||||
engine?: any;
|
engine?: any;
|
||||||
|
live?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueueFilters = {
|
export type QueueFilters = {
|
||||||
|
|
Loading…
Reference in a new issue