7

I embed a video on a Blazor-powered static page. I want the video to loop. According to docs (https://developers.google.com/youtube/player_parameters#loop), I need to have both loop and playlist params. Easy enough.

So I generate URL like this: https://www.youtube-nocookie.com/embed/tFbVZCbLhOk?autoplay=1&loop=1&modestbranding=1&disablekb=1&playsinline=1&rel=0&fs=0&playlist=tFbVZCbLhOk&controls=1&origin=http://localhost:5134 - as you can see, loop is set to 1, and playlist is set to the same video itself tFbVZCbLhOk.

The problem I am having is that when the video is embedded (or the link is accessed directly - the issue occurs there as well), it errors with This video is unavailable. Refreshing the page fixes that, however it of course is less than perfect. I am not sure what causes this, as some videos appear to randomly work on first attempt - but it's inconsistent, cause the same video might fail other time.

Removing the playlist param fixes the issue, but then the video doesn't loop properly, which is even worse for my use case.

I am not sure if it's a regression on YouTube's side, as a month or two ago, I did not have that issue - I think so at least.
It also seems like it's not bound to the tab or anything like that - when I open video once, next time I open it on a separate tab, it works - almost like if YT took its sweet time to create playlist for the video, but that's just my guess

TehGM
  • 211
  • 1
  • 8
  • 1
    Did you happen to come to any resolution here? – TelFiRE Sep 05 '22 at 19:44
  • Good thing you reminded me of this. It resolved by itself. Guess it was just a YT-side error. I'll post an answer to mark as resolved. – TehGM Sep 06 '22 at 20:02
  • 1
    I am still having this issue (so it didn't automatically resolve in my case). I didn't have this issue in the past, so it is definitely a regression on YouTube's side. As workaround I have removed the `playlist` param like you have suggested (I can live with the fact that it is not looping). – JanVdA Sep 06 '22 at 21:09
  • 3
    @JanVdA and TelFiRE - I just checked my project, and you're right - it appears it's broken again. Seems YouTube reintroduced this bug. I'll remove my answer. – TehGM Sep 07 '22 at 15:36

2 Answers2

1

I tried your video sample (i.e. tFbVZCbLhOk) and with the following code (which I modified from this answer), and the looping of the video works fine:

https://www.youtube.com/embed/tFbVZCbLhOk?enablejsapi=1&loop=1&playlist=tFbVZCbLhOk&autoplay=1&rel=0&showinfo=0&color=white

Probably what you're describing is another YouTube undocumented change.

  • 2
    Yeah, it does loop - thanks to both `playlist` and `loop` being present. The issue is that when `playlist` is present, the video sometimes shows as unavailable on first load. I tried adding `enablejsapi` and `showinfo` as in your example, but the effect sadly is the same. For reference, the application loads one of the videos from the list at random, not constantly the same video - which makes the issue way more noticeable. You can see this here: https://randominator.tehgm.net/player – TehGM Apr 13 '22 at 18:38
  • @TehGM well, in that case, I suggest you to see in [Issue Tracker](https://issuetracker.google.com/issues?q=status:open%20componentid:186600&s=created_time:desc) if someone else has this problem or you can post there the issue as well. I bet this is some sort of undocumented change or the petition(s) are blocked for your page. Check also the console "press F12" and see if any problem/error shows. (consider check the "navigation" tab as well. – Marco Aurelio Fernandez Reyes Apr 13 '22 at 19:21
  • As for now there is already reported bug on this specific issue, but unresolved sadly: https://issuetracker.google.com/issues/249707272 – 1haker Oct 03 '22 at 07:45
0
<iframe onload="this.src+='';this.onload='';"

This reload once the iframe and after that it stops. I hope it will help you.