I'm trying to use the YouTube IFrame API on a Tizen Web App to show my company video projects, but many of these videos show a "Video unavailable" error, and from the onError event I get an error code 150. Of course, all videos are configured to allow embeds.
For example, this video will play fine:
https://www.youtube.com/embed/XZc76zYrsdU
But this one won't play, and will show the mentioned error:
https://www.youtube.com/embed/9t4UooKRhBQ
Here's some code that I use to load the YouTube IFrame from within my app:
// creating fullscreen div for the YouTube IFrame API to populate
var divYt = document.createElement("div");
divYt.setAttribute("id", "player");
divYt.style.width = "100%";
divYt.style.height = "100%";
divYt.style.position = "absolute";
divYt.style.top = "0";
divYt.style.left = "0";
divYt.style["z-index"] = "9999";
divYt.style["box-sizing"] = "unset";
document.body.appendChild(divYt);
$scope.player = new $window.YT.Player("player", {
videoId: $scope.videoIdSel, // the ID of the selected video
events: {
"onReady": onPlayerReady,
"onStateChange": onPlayerStateChange,
"onError": onPlayerError
}
});
If the user selects the first video in the example, everything works fine, but if the second video gets selected, the onPlayerError function gets called instead, returning data: 150
Looking up online I've seen some people suggesting the error might be related to a copyright claim, but in this case both of the videos are demonetized, so I don't think that's the problem in my case.
Note: this error also happens when pasting the links in a new tab, but not when clicking a link that opens within the same page. I've also noticed that if I open the second embedded video in incognito mode on Chrome, it mysteriously works fine, but of course I can't do that on my web app.
I'm struggling to understand what's causing this problem. Can someone please help me out? Thanks :)