Open willondubs opened 7 years ago
Hi, same problem here. I think that's a problem about streams. I found a solution. Just don't use this package, and use youtube-audio-stream (dependence of this package). You can save the stream in a variable, then .close() the stream. After than you can play another song etc.
const stream = require('youtube-audio-stream')
const decoder = require('lame').Decoder
const speaker = require('speaker')
var stream
var url_one = 'https://www.youtube.com/watch?v=hTWKbfoikeg'
var url_two = 'https://www.youtube.com/watch?v=VkvOLB7Yzhs'
stream = stream(url_one).pipe(decoder()).pipe(speaker())
setTimeout(function(){
stream.close()
stream = stream(url_two).pipe(decoder()).pipe(speaker())
setTimeout(function(){
stream.close()
},15000)
},15000);
Thanks, I'll try it. I tried youtube-audio-stream initially and couldn't stop the stream. For now, I'm using mopidy's youtube player. I'll revisit this.
Hi, Thanks for making this. I'm using it in an express route. It starts and stops great but I'm getting the "write after end" when starting again. Could you help me fix this? Here's my code:
Thanks!