[PLUGIN] YouTube for Volumio

Hi,

This is the “2/3 problem” that seems to bug Volumio users only. It used to happen with Discord as well but they seem to have got around that (Volumio and Discord have different mechanisms so not really relevant).

The problem is due to the outdated version of MPD which Volumio uses. In the context of the Youtube plugin, when you click on a video:

  1. The plugin fetches the Streaming URL that corresponds to the video
  2. It then sends it off through the Volumio API to MPD which is actually responsible for playing data from the streaming URL

So MPD gets the streaming URL and plays it. And it happens that the Volumio-bundled MPD, which is version 0.20, does not work well with these URLs and most would get cut off around 2/3 into playback.

For YouTube streams, there are mainly two formats: opus webm and mp4. I have done some testing with Volumio’s MPD on various YouTube streams by passing the streaming URLs directly to MPD through the MPC client instead of Volumio’s web interface. Here’s what I found:

  1. With Webm streams, Volumio’s MPD plays but seeking is broken
  2. With mp4 streams, Volumio’s MPD plays with seeking but it actually fetches the entire stream before beginning to play! That means if you want to play a 1-hour stream, you would have to wait for like 5 minutes for the entire stream to be fetched before you will hear sound.
  3. For both types of streams, the 2/3 problem exists. There is no guarantee that MPD will play till the end and there are no warnings or errors if the stream ends abruptly.

Then I tested the same streams with the latest MPD (version 0.21.16) on my local computer. I did not experience the above problems. Everything played as it should with no cut-offs.

The reason why Volumio is still using the old version is because it is running on an old version of Debian / Raspbian. For Debian, Volumio is still running on Debian 8 Jessie that was released 4 years ago. That version was no longer maintained nor updated and while two stable versions of Debian have been released since, Volumio is still stuck with the antique release.

Recently, the Volumio team has finally decided to give Debian 10 Buster (latest version) a try and is testing out an alpha version for x86 platform (that means Intel and AMD but not for Raspberries and other ARM devices). We could wait until they release a stable version of it for all supported platforms.

Or you could, like me, compile the latest version of MPD for your device. I managed to crank one up for my device that’s running Debian 8 and can play Webradio, DLNA, and Youtube streams (with no cutoffs and seeking works) - haven’t tested other things though. I’ll test it a bit more and post my results.

Best regards,
Patrick

Hi Peter,

When you say you run Volumio on an IPad, did you mean you use Safari to browse Volumio? I haven’t tested changing the plugin settings on an iPad and unfortunately I don’t have one for testing. I did just try on an Android device with Chrome and it works.

Would it be possible for you to try on a desktop computer and see if you still have the blank code box problem? If that’s the case, then it could be a bug with Volumio’s web interface API (putting a code inside the box is actually done through a function provided by said API).

Best regards,
Patrick

1 Like

Hi Patrick,

I’m not too sure what you mean by “do you browse Volumio through Safari “

I run Volumio directly via the App. I also have Google Chrome installed. Surely, I’m not the only person to run Volumio on an IPad.

However, I will do as requested and install Volumio on my Microsoft Surface just see if there is any resolve, although this is not my preferred choice.

Having the YouTube plugin would have been nice but if it doesn’t work, I’ll just de-install it.

If you do find any resolve, I would be very grateful if you can get back to me.

Peter

We just started a general overhaul of the YouTube plugin, to make it work properly again (just as we did with Spotify plugin).
Please be patient and hopefully in less than 20 days you should have it back and running again

Could you try changing the settings in a regular web browser? On your Surface, open up Google Chrome and enter volumio.local/ in the address bar should take you to the Volumio web interface.

Hi,

I’ve got the same trouble. Code is Blank.

Volumio is running on a Raspberry Pi 3B
Volumio version : 2.673
Youtube plugin version : 0.1.0 Update 22/08/2019

I tried using Chromium on mobile, firefox and chrome on a computer.
I’ve got Spotify and volspotconnect2 which are working fine.

Thanks for your time and if you have more question or things to try.

Hi,

You said “Youtube plugin version : 0.1.0 Update 22/08/2019”

Did you install the one from the “official” repository and not the one which I put up here?

The official one has been broken for quite a while and will not work. You need to use the one I provided and follow the instructions to create a Google API key before using it. Or you could wait for the Volumio team to update their plugin which they say will be available in around 20 days.

Instructions for creating the Google API key can be found here

Hi Peter,

It suddenly occurred to me and I would like to confirm…are you using the “official” plugin instead of the one I uploaded to this thread a while back?

Please read my response to ValNyz just above.

Best regards,
Patrick

You’re right, it’s the official plugin. I’ll try your version. It might be good to remove the official plugin and put yours with custom instruction in place.

Thank you very much.

Hi Patrick,

Thnx for your reply! (and your awesome work!)

I tried to play one of the best songs of my people :stuck_out_tongue_winking_eye: *just one I remember that didn’t want to play at all… not at the office now, so can’t check others

youtube.com/watch?v=SccjaskA1n8

Hi TonyK and others who are having recent problems with playing YouTube tracks,

The attached update should solve this problem. To update your existing YouTube plugin, download the attached zip file to your Volumio device, extract it to some directory, then:

If that doesn’t work, try uninstalling the existing YouTube plugin first, then:

As usual, let me know if there are any issues with this version.

And Merry Christmas everyone!

-Patrick
youtube-20191224.zip (5.75 MB)

Hi patrickkfkan,

your manual worked like a charm!

Only one thing to mention: The Client-Secret field should be treated as password field. so the Secret should be stored encrypted. It is just a mention, because we are in LAN (which is hopefully trustworthy) and there is no TLS encryption.

Do you have any information when the plugin is officially available in that kind of state?

Kind regards

Hi Pit-Storm,

Thanks for your suggestion.

I’ll consider using password fields for the credentials section in the plugin settings, but in the end those credentials will still be stored as plain text in the backend. The ‘****’ password fields are only good for preventing people from snooping behind your back and getting your API keys when you access the plugin settings.

So why don’t we encrypt the credentials before storing them to disk? The reason is, there’s really no point in encrypting the password before writing it to the configuration file. Volumio is open source and the password could easily be obtained by reversing the encryption process. If you understand the process in which Chrome, Firefox, IE, etc. store user passwords locally, you’d be surprised at how easy it is to fetch those passwords back (interesting read: http://raidersec.blogspot.com/2013/06/how-browsers-store-your-passwords-and.html)

That said, you should generally be safe as long as you don’t share the password to the ‘volumio’ (and of course ‘root’) user account with other people, and those who have access to your LAN are trustworthy (i.e. they won’t sniff the network to get your API keys). Also, if you set up your YouTube API credentials correctly, then YouTube read-only access is allowed and the worst-case scenario is that your daily API quota gets eaten up. Furthermore, If you found someone else is using your credentials you can just delete them from your Google developer console and set up new ones.

As far as the official plugin is concerned, unfortunately I do not have any say in what will be included, when it will be released, etc. I have no ties nor communication with the Volumio team so it is entirely up to them to decide what to do with the plugin. Being opensource, they are of course free to pull code from my Github if they wish. @michelangelo did say a few posts back that they will be releasing one soon, so let’s see what improvements that will entail.

-Patrick

I registered me to say a special thanks to you all and especially to patrickkfkan!
Having Christmas music from youtube tonight :laughing: :laughing: :laughing:

The only issue I had, I downloaded the zip plugin in te same folder where I wanted to exctract it.
That threw an error while installing.
But fixed now. :nerd:

You’re welcome, and Merry Christmas! :smiley:

Hi Patrick,

Firstly, thank you for your hard work and contribution to Volumio community.
As u said, we can compile the latest version of MPD to resolve “2/3 cut off” issue of Youtube plugin. So, can you guide me how to compile the latest version of MPD? All my try from google is all failed :unamused:

Hi Patrick, thanks for the workaround. Unfortunately, the youtube plugin does not start (error: can not start plugin) after installation based on your guideline. I have Volumio version 2.555. I could setup all the credentials needed in googleapi, but now I never reach the point of being able to put in the credentials. If I install manually the “official” youtube plugin, the plugin starts - but no code, as is known. Any suggestions. Thanks and best Regards
Andres

I’m having trouble granting read only access for Volumio. When going to settings to acquire a code to supply to google devices, no code appears. How do I get the plugging to provide a code number?

Hello,

I need to polish up my build scripts before making them available. Give me 1-2 days.

What device are you using? I’ve only tested mine on an ARM device, but not the X86. I do have one compiled for the x86 but haven’t got around to testing it yet (need to get a spare x86 or maybe setup at VM to test it).

-Patrick

Hi Andres,

Could you check your Volumio log and see if there are any error messages when you load the plugin?

I am using version 2.657 , so I’m not sure if it’s backwards compatible with 2.555. Is it possible for you to upgrade your Volumio ? Maybe use another SD card for testing?

-Patrick