[PLUGIN] YouTube Music

In YouTube music menu items is Start radio but there is missing this item in menu.
Is possible to add this item?

Thanks,
Lavis

If I understand it right, so it may be simple. On FAQ — ytmusicapi 1.0.1 documentation i see:

How can I get the radio playlist for a song, video, playlist or album?
songs, videos: RDAMVM + videoId
playlists, albums: RDAMPL + playlistId

patrick will reply…

No. Unless I missed something, context menus are not customizable in Volumio. The type of item determines the menu contents.

With this plugin, the current behavior is as follows:

  1. For sections that show a combination of different item types (songs, albums, artists…), clicking a song will play the radio associated with that song. Example is Home → Listen Again.
  2. For sections that contain entirely songs, clicking a song will play the entire section, starting with the selected song. Example is Home → Quick Picks , or when browsing contents of a playlist / album.

For (2), I can easily change the code so that it starts a radio, but that might be confusing for some as the normal behavior in Volumio is to add the entire block of songs to the queue. For mixed items in (1), on the other hand, I had no choice other than to start a radio. Personally I think (1) is confusing because there is no visual element to distinguish between artists, songs and albums.

playlistId and related data is actually encapsulated within a song’s URI. You can see it when you add a song to the queue, then go to http://<volumio_address/dev. This info is used for Autoplay, so you will be essentially playing a radio if you do this:

  1. Go to plugin settings. Enable Autoplay.
  2. In the menu for a song, click ‘Play’.

After song has ended, or if you click Next, the plugin will fetch the next batch of songs from the radio and play them.

Thanks for the explanation.
The trick with Autoplay is sufficient for me.
I’m sorry for my laical post about that it may be simple.
The Volumio and the YT Music plugin are great and the Autoplay solve the Start radio function.

Updated v0.2.2, which addresses the same issue affecting YT plugin:

Basically the same fix as YT plugin:

To install the updated plugin from beta channel:

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

Got bored of waiting for the script. I can confirm that deleting the plugin folder from /data/plugins/music_service and rebooting frees up the system so you can follow @patrickkfkan 's instructions. Then everything works again. Thanks Patrick for getting the fix to us so quickly.

Updated v1.0.0:

  • Add prefetch support and ‘Prefer gapless Opus’ option. See here to understand what the latter option is for.
  • Autoplay: fallback to radio if no autoplay items available (happens when playing private uploads)
  • Lazy-load API instead of loading when plugin starts. This avoids the issue that plagued earlier versions, where the API effectively froze Volumio.

The plugin has been rewritten in TypeScript, hence the major version change from 0.x to 1.x. If you spot any regressions, please report them here.

v1.0.0 currently in beta channel of Volumio plugin store. To install:

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

(All steps mandatory)

2 Likes

Maybe I am missing something but when I use the YouTube plugin everything seems to work but playback stops after some time, like 20-30 minutes when the playlist is over four hours. I can click on the next icon to restart but it stops again after sometime. If I try to uninstall, it gives me an error and the only way to remove the plugin is to delete the folder and reboot.

Tried to reinstall after deleting the folder rebooting and setting plugins to dev mode as indicated above and now it gives this error:


but when I go back to installed plugins, it is there and I can select a playlist:

What am I doing wrong? Running latest version of Volumio on RP 3B+.

Regards,

1 Like

Logs would help.

Does this happen every time and with any playlist?

Yes it does happen every time. I’m out town right now but will send logs when I get back next Friday 29th

Regards,

Hi Patrick,

Here is the log as requested. It stopped after playing 4 tracks even though the playlist is 24 tracks long. I just picked the playlist and clicked on the play icon:
image
I can send more logs later if you wish.
image
System Info:

OS info
Version of Volumio: 3.512
Hostname: musicbox2
Kernel: 5.10.92-v7l+
Governor: performance
Uptime: 0 days, 1 Hrs, 7 Minutes, 29 Seconds
Audio info
Hw audio configured: Headphones
Mixer type: Hardware
Number of channels: 8
Supported sample rate: 44100 48000 88200 96000 176400 192000
Board info
Manufacturer: Raspberry Pi Foundation
Model: Raspberry Pi 4 Model B Rev 1.5
Version: b03115
Firmware Version: Jan 20 2022 13:56:48 - bd88f66f8952d34e4e0613a85c7a6d3da49e13e2
CPU info
Brand: BCM2711
Speed: 1.5Ghz
Number of cores: 4
Physical cores: 4
Average load: 10%
Temperature: 61°C
Memory info
Memory: 1962272 Ko
Free: 1333656 Ko
Used: 628616 Ko
Storage info
INTERNAL storage - Size: 12135Mo
Used: 1461Mo
Available for storage: 10044Mo (83%)

This is on my second system. My other system runs on a RP3B+, both running Volumio 3.512 and gives similar results so maybe I am doing something wrong. Thanks for your help and your great plugins.

Regards

1 Like

Happened again with same playlist, this time on track 10 out of 30. I started the playlist again from the YouTube playlists. Here is the log.

Regards,

Thanks for the logs. The 2nd one captured some errors related to browsing, but that shouldn’t matter for the time being.

What is strange is that both logs do not indicate an error of any sort when playback failed to continue to the next song. It is as though the queue just reached the end.

Could you disable all other plugins and see if that makes a difference? Also, disable Autoplay, Prefetch and Prefer Gapless in the plugin settings.

Also spotted an (unrelated) issue with prefetch not being called by Volumio. But I’ll leave that for another day…

I have done as you suggested and will report back.


In case it helps, here is another log from my other device, where it stopped after the fourth track out of twenty seven. This is the one I have turned off all plugins. Both devices have identical software and plugins (except for the RPi device, this has a 3B+ and the other a 4) but I use his one daily as it is in my living room.

Thanks for checking …

Stopped at track two http://logs.volumio.org/volumio/ZxJaPwV.html restarted it and it stopped again http://logs.volumio.org/volumio/uw8U3BD.html

YouTube doesn’t like me :frowning_face: :cry:

I could not reproduce the problem you are having. I left YouTube playing overnight and it has been playing for at least 10 hours non-stop (looping the entire “Presenting Stevie Ray Vaughan” playlist).

One more thing though, do you have PeppyMeter installed? I did find that, with Peppy in the audio pipeline, playback fails at some point along the way. I had to actually restart Volumio to be able to play anything again.

If you can SSH into your Volumio, could you also do this:

$ tail -f /var/log/mpd.log

Let’s see if the output captures anything useful at the point when playback fails to continue.

Could it have to do with my install? I keep getting an error when I try to uninstall the plugin (see earlier post). Tried just now and got the error again, here is the log file. I have tried to delete the ytmusic plugin folder and reinstalling but it hasn’t helped before. I will re-flash the SD card and install just this one plugin and see if it works any better.

Thank you for your help, I will keep you posted …

OK Did a fresh install of Volumio and have just the YouTube plugin installed - nothing else at all. Tried a new playlist and it stopped through the first track. This time I was watching the output of tail -g /var/log/mpd.log and this is what I got:
Jun 25 17:26 : zeroconf: No global port, disabling zeroconf
Jun 25 17:26 : zeroconf: No global port, disabling zeroconf
Jun 25 17:26 : client: [0] opened from local
Jun 25 17:26 : client: [1] opened from local
Jun 25 17:26 : zeroconf: No global port, disabling zeroconf
Jun 25 17:26 : client: [0] opened from local
Jun 25 17:26 : exception: No such directory
Jun 25 17:26 : client: [1] opened from 127.0.0.1:33742
Jun 25 17:26 : exception: Failed to read mixer for ‘alsa’: no such mixer control: PCM
Jun 25 17:26 : client: [2] opened from 127.0.0.1:33746
Jun 25 17:27 : client: [1] closed
Jun 25 12:27 : client: [2] closed
Jun 25 12:28 : zeroconf: No global port, disabling zeroconf
Jun 25 12:28 : client: [0] opened from local
Jun 25 12:28 : client: [1] opened from local
Jun 25 12:28 : client: [2] opened from 127.0.0.1:33756
Jun 25 12:28 : client: [3] opened from 127.0.0.1:33760
Jun 25 12:28 : exception: Failed to read mixer for ‘alsa’: no such mixer control: PCM
Jun 25 12:29 : client: [2] closed
Jun 25 12:29 : client: [4] opened from 127.0.0.1:33784
Jun 25 12:29 : client: [5] opened from 127.0.0.1:33788
Sep 28 15:13 : client: [3] closed
Sep 28 15:13 : client: [4] closed
Sep 28 15:20 : exception: Failed to open mixer for ‘alsa’: no such mixer control: PCM
Sep 28 15:20 : client: [6] opened from 127.0.0.1:33936
Sep 28 15:24 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:24 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:24 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:24 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:24 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:24 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:25 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:26 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:26 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:26 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:26 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:26 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:26 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Sep 28 15:26 : alsa_output: Decoder is too slow; playing silence to avoid xrun

Started the next track icon and it played couple of more tracks and then gave the same error messages, here is the log.

I normally play either web radio or local music files and I do not get this issue at all, so I hope this means something to you.

Thanks again …

These errors could be due to the decoder not receiving stream data fast enough to process and push out to the audio output. I suspect you have a slow / faulty / unstable network connection since you’re getting these errors on both your devices, whereas I didn’t get any in my tests on x86, rpi3b and rpi4.

Increasing “Buffer Time” in Playback Options might help, but no guarantees. I would first restart my router and use / change Ethernet cables connecting to the Volumio device.