Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin Option not working #200

Closed
kubsar opened this issue Aug 10, 2017 · 3 comments
Closed

Begin Option not working #200

kubsar opened this issue Aug 10, 2017 · 3 comments
Labels

Comments

@kubsar
Copy link

kubsar commented Aug 10, 2017

Hey!

I love the module and everything works perfectly but the begin option. I just can't seem to get it working. As I couldn't find similiar issues, I might think that it's my code. The video always starts playing at 0:00, no matter what time format I try to supply. I work with discord.js. Hope someone can help, thanks in advance!

const tagID = message.author.tag.split('#', 2);

if (tagID[1] == '6133' || tagID[1] == '0219') {
	const [command, youtubeLink, beginTime] = Util.splitWithTail(message.content, " ", 2);
	const voiceChannel = message.member.voiceChannel;

	voiceChannel.join().then((connection) => {
		const stream = ytdl(youtubeLink, {
			filter : 'audioonly',
			begin : (beginTime === null) ? '0:00' : beginTime
		});
		const dispatcher = connection.playStream(stream);
		dispatcher.on('end', () => {
			message.delete();
			connection.disconnect();
		});
	}).catch((error) => {
		console.log("[ YT PLAYBACK ERROR ] " + error);
	});
}
@fent
Copy link
Owner

fent commented Aug 11, 2017

Is there a specific video it does not work with? We've found that it tends to not work with shorter videos (30s), or lower quality videos.

There's a note on the readme for the option

This option may not work on super short (less than 30s) videos, and has to be at or above 6s. See #129

@kubsar
Copy link
Author

kubsar commented Aug 11, 2017

Thanks for the reply! I tried a lot of videos. Long ones, short ones, hq / lq ones, tried to obey the 6s "bug" you mention in the readme, but it doesn't work with any video I try. I tried different params e.g. 1:23, 1m23s, 73800 (as in ms) and so on. Can't get it to function :S Tried to debug myself because I didn't wanna bother you, but as it is as of now you guys here are my last resort :>

@TinyMan
Copy link
Contributor

TinyMan commented Aug 11, 2017

I faced a similar problem, and finally understood the matter. You can follow the discussion in #129 and in #159 . I ended up creating node-jamy who can stream youtube's audio.

But the simplest solution, for you, is to use ffmpeg with -ss parameter. It will still download the entire video but start playing at the requested location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants