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:
The plugin fetches the Streaming URL that corresponds to the video
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:
With Webm streams, Volumio’s MPD plays but seeking is broken
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.
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.
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).
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
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
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?
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.
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
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
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).