Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The embedded player shows "Please click here to watch this video on YouTube" to some users under unclearly circumstances

We use the YouTube embedded player on a hybrid app based on Cordova. The app has a lot of traffic worldwide.

The player displays the message "Please click here to watch this video on YouTube" to some users when they try to play any video under unclearly circumstances.

We do not see a clear pattern, it doesn't seem to depend on the user's country nor the restrictions of the video.

We have seen in the player code (https://www.youtube.com/yts/jsbin/player_ias-vflrnurMS/en_US/base.js) that the message is assigned to a constant called "TOO_MANY_REQUESTS_WITH_LINK" but there is no high volume of requests per user and the quota cannot be configured as in other Google APIs.

We follow the iFrame API reference: https://developers.google.com/youtube/iframe_api_reference?hl=en

<iframe id="player" src="https://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&amp;cc_load_policy=0&amp;controls=0&amp;disablekb=1&amp;enablejsapi=1&amp;fs=0&amp;iv_load_policy=3&amp;loop=0&amp;modestbranding=1&amp;playsinline=1&amp;rel=0&amp;showinfo=0&amp;wmode=transparent&amp;origin=XXX" frameborder="0"></iframe>

<script type="text/javascript">
    var player,
        scriptTag = document.createElement('script'),
        firstScriptTag = document.getElementsByTagName('script')[0];
    scriptTag.src = "https://www.youtube.com/iframe_api";
    firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag);
    function onYouTubeIframeAPIReady() {
        var options = JSON.parse('{"autoplay":1,"cc_load_policy":0,"controls":0,"disablekb":1,"enablejsapi":1,"fs":0,"iv_load_policy":3,"loop":0,"modestbranding":1,"playsinline":1,"rel":0,"showinfo":0,"wmode":"transparent","origin":"XXX"}');
        if (!options.origin) {
            options.origin = location.origin ||
            location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '');
        }
        player = new YTRemoteVPlayer('player', '<%-videoId%>', options);
    }
</script>

Does anyone know what may be happening and how to fix it?

like image 682
angel.teran Avatar asked Oct 22 '19 10:10

angel.teran


2 Answers

Me and my teammates managed to reproduce that behaviour locally.

To reproduce that behaviour, all you need to do is, under the same IP Address, to load the youtube JS multiple times and for different videos. Although I cannot clarify the exact amount of times it must be done (we left some devices aside doing it), the behavior certainly happened.

As an attempt of a workaround for that problem, we accessed the https://web.archive.org/web website and fetched an old YouTube JS script (https://www.youtube.com/iframe_api). We tried to use that old script, but with no success. The message continued to appear =/.

I really do not know if there is much we, developers, can do about it, but wait for an YouTube statement and/or revision of recent changes on their end.


Update

There is an issue opened on Google's issue tracker website:

  • https://issuetracker.google.com/issues/143091693

Update

It looks like that YouTube have resolved that problem on their end. We'll keep monitoring :)


Update (November 5th 2019)

The problem is happening again.


Update (November 7th 2019)

I have opened a new issue on issuetracker: - https://issuetracker.google.com/issues/144057800

like image 117
Augusto Carmo Avatar answered Oct 13 '22 06:10

Augusto Carmo


I don't have a fix for it, but I can add more information about the problem, this way maybe someone can help us with this issue.

I am getting the same error with some users, and like you said there is no a clear pattern. My devices are working properly, but I did some tests with the help of a user of my app that is getting this error. Following the results:

Demo used in my tests: https://developers.google.com/youtube/youtube_player_demo

Test 1 - Open the iframe player api demo on device's browser - WORKED

Test 2 - Open the iframe player api demo into a webview on my app - FAIL

Test 3 - Open the iframe player api demo into a webview on my app using a VPN connection - WORKED

So, it appears to be a combination of APP + IP is blocked. I don't know the reason, and it will be very helpful if someone repeat these tests. I am trying to confirm it with another user, but it's a little hard to find someone willing to help.

UPDATE: a second user tried to use a VPN and it worked to him too.

UPDATE 2: a user with this problem told me that the videos are working properly again now. It appears to be a temporary block by Youtube on server side.

like image 3
Allan Bueno Avatar answered Oct 13 '22 05:10

Allan Bueno