patrickkfkan / volumio-youtube2

35 stars 7 forks source link

websocket api to play Youtube url #13

Closed ghost closed 6 months ago

ghost commented 6 months ago

hello,

is it possible to play and add a YouTube URL directly to Volumio with the Volumio websocket api ?

patrickkfkan commented 6 months ago

No, you cannot just send the full YT URL. What you can do is construct a URI with the video ID and send that through websocket. The URI has this format: youtube2/video@videoId=<video_id>. So, for e.g.:

YT URL: https://www.youtube.com/watch?v=F7FppXJ-3YY

Video ID is F7FppXJ-3YY, so the URI would be: youtube2/video@videoId=F7FppXJ-3YY

Send through websocket:

socket.emit('replaceAndPlay', {
    uri: 'youtube2/video@videoId=F7FppXJ-3YY',
    service: 'youtube2'
}) 
ghost commented 6 months ago

Thank you, works well, great plugin!