Some videos not playing (YouTube) on Windows

Hello. I have a desktop app for Mac and Windows that has a feature of playing short videos hosted on YouTube. I heard from a couple of customers who are experiencing “An error has occurred on playback ID XXXX”. I ran through all of the videos in my Mac app, and all played just fine. I did notice that about 30 of the 100+ are showing the error message in my Windows app

Here are some of the thing I tried/tested

  • I checked to make sure the YT video ID is correct, and they are.
  • I read some posts online to try clearing cache in the browsers (I did this in Chrome and Microsoft Edge as these are the two I have on my Windows machine) and also cleared the cache in ipconfig, but the error message prevailed.
  • On the Windows machine, I brought up my YT Studio to make sure the videos played ok on there, and they do.
  • I rebuilt the app in Xojo with 2023 R3 (previous build was in 2023 R1) and ran on Windows, but the error prevails.

The videos are played in an HTMLViewer. The Viewer’s Renderer is set to WebKit. The videos are played using the following code in a listbox CellClick (the column 1 in the lbx is the YT ID from a database table)

HTMLViewer1.LoadURL("" + me.CellValueAt(row, 1) + "?rel=0&autoplay=1")

I am at a loss and am hoping someone has a suggestion. Again, all 100+ play just fine on Mac. On Windows, about 30 are not playing and are showing the error, while about 70 play just fine

If you eliminate the listbox and use a hardcoded url in a button (or better, a timer launched from a button) does LoadURL still error out?

Hi Tim. Thanks for the reply. Yes, so I actually did make a mock desktop app with 4 buttons and an HTMLViewer. Two were hard coded to videos confirmed to play and the other two were not playing originally. The 2 expected to play did still play, but the other 2 still did not

My thought were maybe it was an API 1.0 issue as the original app is 1.0. The mock app from above was in 2.0, so this wasn’t the problem

I also thought maybe there was a problem of the video upload, so I uploaded a duplicate one in YouTube (new YT ID), tried with the mock app, and that wasn’t it

I then thought maybe I need to switch to Vimeo. I found another post saying that user had an issue playing Vimeo videos (called from a listbox and embedded in an HTMLViewer as my app) on Windows, and he was pointed to one of Christian’s plugins. I tested that out quick, and it worked. However, after deploying a demo app I have, it didn’t seem to load at all (not even an error message). This could be on me as I was nearing the end of my day and couldn’t dissect what I could’ve done wrong. I will be checking the demo app again tomorrow morning to see what I may have missed

To add to the weirdness, to my knowledge, all of the videos have been playing just fine on Windows previously. Yesterday and today were the first times I heard from two separate customers. I wonder if something funky happened on YouTube, or if no one simply reported this to me. This version has been out for about 4 months. Plus, my demo app has been out for almost 2 years, and that one has 3 demo videos in it. I would think in that amount of time, others would’ve said something

Just some rambling speculation, but YouTube has been rolling out changes to their back-end to prevent adblockers. Embeds are one way people historically have adblocked YouTube. This just began within the last few weeks, and it rolls out from user-to-user over time (hence why some users may have problems and others may not). Are you setting the User Agent in your htmlviewer to mimic a modern browser? If not, give it a try and see if that helps. You might also try direct-linking to the video page on YouTube itself.

Thanks for the info Christian. It’s good to know this could actually be a YouTube thing. I’ll give the UserAgent thing a try and see if that helps

I’d rather not link right to the YouTube page, but it might come to this or I’ll have to come up with another solution

Just an update on this. I tried the UserAgent code as supplied in the docs. Added to the HTMLViewer1.opening (not sure if that’s where it is supposed to go), but this did not help

Using @Christian_Schmitz WebView2ControlMBS did look promising and did work on Windows, however, after I built the installer, the WebView2ControlMBS just seemed to have disappeared. Weird. If I take the built app (not as an installer) and run it on Windows, the WebView2ControlMBS worked. Once I signed it with kSign (K Software) and built with Innosetup, the control was not there so the video did not play. Wondering if something does not get signed properly with this??

I then signed up for the free trial of Vimeo. I’ve been wanting to switch to this to get more control over the player (disable the sharing option). Mac worked just fine, though I did not make an installer package so maybe it wouldn’t, but the debug app worked. On Windows, it looked promising. The HTMLViewer showed the embedded video on Vimeo, but as soon as I hover over it, I get a “Player error. The player is having trouble” message. Has anyone gotten Vimeo videos to successfully be embedded in desktop apps and play on Windows (and Mac)?

This is the call to the viewer, maybe this is wrong:


I do remember Xojo disabling the widevine update because some users thought it would be “intrusive”, maybe related?

It would be interesting having a project setting and 2 engines, at build time Xojo would add one or another, one with Widevine properly set, default, and one without it, to satisfy people that think it is some kind of problem.

I didn’t know about this, so maybe it could be related. Though, if it were, I would assume none of the videos would play on Windows, yet around 70 do and 30 don’t. Plus, not sure when that was implemented, but my current app was built on 2023r1 four months ago, and I’m only now hearing from customers

After much playing around with this, I decided to implement a band-aid for my Windows users. They have the list of videos to watch but also a label saying “video not playing?” And a button for “show in browser” to take them to the YouTube page to watch the video. If this ever gets fixed or a different solution becomes available, then I’ll rip that band-aid off

Nope. YouTube does not serve all videos encoded the same way. Some would play, some needing DRM updated not backward compatible with some fallback won’t, if the machine has no proper codecs too, and that’s why people add several codecs to some machines using codec packs.

If you right-click some videos at youtube and choose “statistics for nerds” you may notice some differences as:

Video 1 uses video codec 248 vp09, video 2 uses 399 av01:

1 Like