Node-ytdl-core: play live videos

Created on 29 May 2017  路  8Comments  路  Source: fent/node-ytdl-core

Hi, I am wondering if ytdl-core can play any live videos? I try to do it with this video https://www.youtube.com/watch?v=1-AODuJpCG4 and it played only for like 1 second and then nothing else is playing. Thanks!

Most helpful comment

The audioonly filters gets the highest quality, which may not always be the "live" version. Itags 91 through 95 are for live streaming.

All 8 comments

Yes, it should be able to play it. And it works for me when I try it.

How are you calling ytdl-core?

I am using ytdl-core in an discord bot program. And I call it using something like this:
let stream = ytdl(songId, {filter : 'audioonly'});
let dispatcher = voiceConnection.playStream(stream);

The audioonly filters gets the highest quality, which may not always be the "live" version. Itags 91 through 95 are for live streaming.

ohh i see. Thank you so much for the info! And thank you for making ytdl-core! :DDD

Hi fent, I have a problem resuming live videos and wondering if you have any insights on this.

I first play the live video using let dispatcher = connection.playStream(liveStream), and then I pause it using dispatcher.pause(). After pausing around 5 minutes, I resume it using dispatcher.resume(), and the dispatcher just ends with reason undefined.

I am not too sure if it's a discord.js or ytdl-core problem, so I also asked the same question in discord.js, and @iCrawl has suggested livestreams had some issues before, and wondered maybe you have some insights on this. Thanks!

YouTube does not allow you to pause a live video. If you go to a live video page, you'll notice that there is no pause option, there's a stop option instead. This sounds fine, as it doesn't make sense to be able to pause a live video.

There are services like Twitch that allow you to pause live playback. But sometimes, if you pause for too long, it'll start streaming the latest live portion anyway.

ahh i see. Thanks for the info again! :D

if (prefix + "play") {
const voiceChannel = message.member.voiceChannel;
if (!voiceChannel) {
}
voiceChannel.join().then(connection => {
let stream = yt(args.join(" "), { audioonly: true });
yt.getInfo(args.join(" "), function(err, info) {
const title = info.title;
console.log(${message.author.username}, Queued the song '${title}.');
message.channel.sendMessage(\${title}``);
});
const dispatcher = connection.playStream(stream);
dispatcher
.on("end", () => {
voiceChannel.leave();
var channel = message.member.voiceChannel;

        if (!message.guild.voiceConnection) channel
            .join()
            .then(function(connection) {
              play(connection, message);
            }); 
            console.error(Error);
            const video= ('ytdl') 

     });
  });
}

});

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NeuronButter picture NeuronButter  路  6Comments

ajgeiss0702 picture ajgeiss0702  路  5Comments

FireController1847 picture FireController1847  路  5Comments

arcovoltaico picture arcovoltaico  路  6Comments

Asaduji picture Asaduji  路  6Comments