[PLUGIN] YouTube Cast Receiver

Right, I suppose there’s a difference between CC-Audio and CC with Google TV (which is what I have). I don’t know if it is possible to tweak the plugin so that it plays audio while preserving video playback on the client (and to keep them in sync). Would have to play around a bit… Right now the plugin is emulating as close as possible the behaviour of YouTube TV, without the video part. It will never be the same because it takes too much effort to fully reverse engineer YT TV…

1 Like

I get it. I fully appreciate theres many limits in what level of APIs and documentation people have.

I also think volumio itself not the plug in is acting as a ‘video’ cast device (at least in windows chrome, casting, it shows up as one, while smart speakers show up as a speaker) but I am guessing way above my pay grade there.

I am totally new to volumio, just tinkering about so far… Still waiting for my DAC in the mail also.

I still have a CC Audio plugged into my DAC, don’t really use it anymore but did the job for years. No gapless playback was the main downfall and reason for replacing it with a RPi4, I think the sound quality is a bit better too.

I will have to test it again but don’t recall the video is ever preserved when casting the audio (this was never allowed anyway unless casting a tab from Chrome. Likewise I can’t cast YouTube video to a Google speaker (like the nest audio). I am sure there would be sync issues anyway if trying to run on both devices.

So the YouTube and YouTube music volumio plugins are still very handy, but this new cast plugin makes this much more convenient.

Agree that Bluetooth isn’t ideal these days (phone sounds and notifications as mentioned, and playback stops when the device is shut down) and prefer multi tasking by streaming over wifi (ie use PC speakers for over tasks etc). I got a better wifi 6 ax card and it has BT as well, one antenna for each so that’s always an option for better signal. Also some DACs have 2-way BT 5 and the quality is good, High res apparently.

Updated v1.0.3.

Added option to not automatically stop current playback when all clients disconnect, unless the connections were ended explicitly.

To explicitly end a connection, you need to tap the ‘Stop Casting’ button in the client app or website. Moving your phone out of range of your Volumio device’s network or closing the web browser will not end playback (@G-rig)

@Sefton , unfortunately I have been unable to emulate the plugin as a Cast-enabled speaker. I suspect audio casting is done through a higher version of the Cast protocol (V2 or higher), which is something the plugin isn’t compatible with (and will probably never be).

v1.0.3 is currently in beta channel. To install from beta channel (all steps are mandatory):

  • Uninstall current version.
  • Enable Plugins Test Mode in http://<volumio address>/dev
  • Find the YouTube Cast Receiver plugin in the plugin store. Click the Details button under it and choose latest beta version to install.
  • Restart Volumio.
2 Likes

Thanks Patrick for your efforts, will install today :slightly_smiling_face:.

Updated v1.0.4:

  • Added prefetching. When enabled in plugin settings (default is enabled), the next song or video is prefetched when current playback is about to end. This reduces the delay you might encounter when going to the next song.
  • When prefetching is enabled, you also get an option to ‘Prefer gapless Opus streams’. This must be enabled for gapless playback of YT streams on Volumio. Technical reasons according to my limited knowledge of the subject:
    • The other common YT stream format is m4a. However, m4a is not inherently gapless like Opus. It requires special handling which FFmpeg (the decoder library) fails to carry out for YT streams, since they are also of dash type. Simply put, FFmpeg can provide gapless playback of regular m4a, but not dash m4a.
  • The tradeoff, however, is that YT Opus streams are limited to 160kbps. This means if you have a YT Premium subscription, you won’t get 256kbps + gapless playback. This sucks, but you would have to decide whether this tradeoff is worth it. For experimenting with the settings, you can check out Pink Floyd’s “The Wall” album on YT Music. If you disable ‘prefer Opus’, you should hear a slight click between tracks.

    Uploads in your YT Music Library are always provided as m4a streams.

  • Another minor change: the name of your device shown in the Cast menu will now be the same as the one you configured for Volumio (previous versions used the OS hostname).

v1.0.4 is currently in beta channel. To install from beta channel (all steps are mandatory):

  • Uninstall current version.
  • Enable Plugins Test Mode in http://<volumio address>/dev
  • Find the YouTube Cast Receiver plugin in the plugin store. Click the Details button under it and choose latest beta version to install.
  • Restart Volumio.
3 Likes

Not sure if this is working still… Have installed v1.0.4 beta, several reboots.
Is there a chance that chrome browser plugins would be mucking it up?
Have sent a log file.

Edit: Actually it could have been just that particular video that it didn’t like. Seems a bit sensitive perhaps if they are high res or something (?).

Cheers,

So what is the link to this particular video that is causing problems?

https://www.youtube.com/live/riumIqfnh4I?feature=share

Would be interesting to know if it works for you. The new plugin is good in general though I think.
Cheers

I am able to play the link.

Having said that, I think it was a live stream when you played it. Live streams are handled differently by the plugin and tend to take longer to load. In my case, when trying to play a live stream from the same channel (Hospital Records), it took around 15 seconds before playback actually started. Most of the time was spent by MPD (the underlying player) fetching multiple segments of the stream prior to playback.

Thanks for checking. I guess it treats them differently even after they have been uploaded/finished as I wasn’t listening live per se. There was silence at the start so think it was skipping to the next track using the other YouTube2 plugin. All good!

Hi @patrickkfkan, I am having issues with the plugin. I manage to install and it does connect but nothing plays. I have tried a fresh install and also installing both stable and beta versions.

Here’s the log:

info: [yt-cast-receiver] (YouTube) Sender connected: xxxxxx (user: xxxxxx)
(node:1933) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
  assert.ok(this.idling)
    at MPDClient.sendCommand (/data/plugins/music_service/ytcr/node_modules/mpd2/lib/index.js:61:12)
    at Object.get (/data/plugins/music_service/ytcr/node_modules/mpd-api/lib/api/index.js:60:16)
    at MPDPlayer.doGetPosition (/data/plugins/music_service/ytcr/dist/lib/MPDPlayer.js:208:100)
    at MPDPlayer.getPosition (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/Player.js:252:21)
    at MPDPlayer.getState (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/Player.js:301:34)
    at YouTubeApp._YouTubeApp_handleSenderConnected (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/app/YouTubeApp.js:492:89)
    at async YouTubeApp._YouTubeApp_handleIncomingMessage (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/app/YouTubeApp.js:356:46)
    at async YouTubeApp._YouTubeApp_handleIncomingMessage (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/app/YouTubeApp.js:293:13)
(node:1933) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 34)
info: [yt-cast-receiver] Player.play(): wTR-ScwmOXI @ 0s
(node:1933) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
  assert.ok(this.idling)
    at MPDClient.sendCommand (/data/plugins/music_service/ytcr/node_modules/mpd2/lib/index.js:61:12)
    at Object.get (/data/plugins/music_service/ytcr/node_modules/mpd-api/lib/api/index.js:60:16)
    at MPDPlayer.doGetPosition (/data/plugins/music_service/ytcr/dist/lib/MPDPlayer.js:208:100)
    at MPDPlayer.getPosition (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/Player.js:252:21)
    at MPDPlayer.getState (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/Player.js:301:34)
    at MPDPlayer._Player_setStatusAndEmit (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/Player.js:333:84)
    at MPDPlayer.play (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/Player.js:61:94)
    at YouTubeApp._YouTubeApp_handleIncomingMessage (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/app/YouTubeApp.js:403:81)
    at runMicrotasks ()
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async YouTubeApp._YouTubeApp_handleIncomingMessage (/data/plugins/music_service/ytcr/node_modules/yt-cast-receiver/dist/cjs/lib/app/YouTubeApp.js:293:13)
(node:1933) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 36)
[Vollibrespot] : dropping truncated packet from 192.168.0.102:5353
[Vollibrespot] : dropping truncated packet from 192.168.0.102:5353

Thanks a lot!!

Try disabling all other plugins, then restart Volumio. See if plugin works after that.

1 Like

Dear people,

Two audio friends of me attended me at a problem with the youtube cast plugin. Trying it by myself, i am also in trouble. We run volumio 3 updated all on a rpi 4. The app connects as usual, but when press on play, the buffering takes a lot of time. En than it looks likes youtube turns crazy. The screen will refresh and there is now music.

The things Ive done:

  1. Plugin is up to date
  2. Restart de rpi4 next de update of plugin
  3. Update my pc en chrome browser
  4. Trying all different beta and stable versions op plugin.

Who can help me?

Logs?

http://logs.volumio.org/volumio/BO5mFls.html

Did you get this also with latest Volumio stable v3.512 , instead of beta v3.538?

yes also in the stable version

Also give me the logs from running the latest version of the plugin (v1.0.4), instead of pre-1.0…

http://logs.volumio.org/volumio/auk643a.html plugin start niet