Licensed Content Doesn't Load in Embedded YouTube Player

谁说我不能喝 提交于 2019-12-14 02:03:43

问题


I've looked all over and can't find an answer to this question so I'm hoping someone here will know. I'm setting up a website that will embed the YouTube player using the Iframe API. In addition to watching unlicensed content, I'm also planning to watch licensed content (i.e. movies I rent from YouTube or Google Play).

To test things out I copied the code from the YouTube Player API "Getting Started" page YouTube Iframe Player API. I then substituted in several different video ids to test out watching the video. When I got to licensed content I had mixed results. Of the four movies that I rented from Google Play, two played fine and the other two gave an error and would not play. Here were the results along with the youtube video id for each movie:

Played Successfully

  • Ice Age: Collision Course (zaM7lVlLS5Y)
  • Independence Day: Resurgence (Wr1xNdTzS1M)

Did Not Play

  • The BFG (wjxfiaZ1a4w)
  • Pete's Dragon (Tg7tFqt0u4w)

I know what you're thinking, "How could anything about Independence Day: Resurgence be considered a success?". After watching it I found myself wondering the same thing, nevertheless it DID play in my embedded youtube Iframe player . . . if you can call that success.

For the BFG and Pete's Dragon the HTML5 Player and a thumbnail loaded into the Iframe like normal but when I pressed play the player switched to the Flash player and an error message showed on the screen saying "An error occurred. Please try again later. Learn more".

My first thought was that it must be the licensing settings for these two movies so I used the YouTube Data API to query them and here's what I found:

The BFG

  • contentDetails.definition = hd
  • contentDetails.licensedContent = true
  • contentDetails.regionRestriction = "allowed" : ["US","CA"]
  • status.privacyStatus = public
  • status.license = YouTube
  • status.embeddable = true

Pete's Dragon

  • contentDetails.definition = hd
  • contentDetails.licensedContent = true
  • contentDetails.regionRestriction = "allowed" : ["US","CA"]
  • status.privacyStatus = public
  • status.license = YouTube
  • status.embeddable = true

Ice Age: Collision Course

  • contentDetails.definition = hd
  • contentDetails.licensedContent = true
  • contentDetails.regionRestriction = "allowed" : ["US"]
  • status.privacyStatus = public
  • status.license = YouTube
  • status.embeddable = true

Independence Day: Resurgence

  • contentDetails.definition = hd
  • contentDetails.licensedContent = true
  • contentDetails.regionRestriction = "allowed" : ["US"]
  • status.privacyStatus = public
  • status.license = YouTube
  • status.embeddable = true

The only difference I could see was that Ice Age and Independence Day weren't allowed in Canada and since I'm running this test from the US I'm assuming that wouldn't be the culprit.

It was interesting to me that initially the player that was loaded into the Iframe was the HTML5 player but that after pressing play it reverted to the Flash player. This made me think that perhaps it's the video format that could be the problem. Of course, not being the video owner, I wasn't able to determine the video format when querying the youtube data using the API.

In addition, I was able to play all movies successfully from youtube.com and play.google.com. It was only when I was trying to embed them into my website using the YouTube Iframe API.

Here are my user settings:

  • MAC OS X Yosemite 10.10.5
  • Chrome Version 55.0.2883.95 (64-bit)
  • Flash
    • NPAPI Plug-in version 24.0.0.186 is installed.
    • PPAPI Plug-in version 24.0.0.186 is installed.

Could it be a bug in the YouTube player? Could it be a problem with the actual video? Could it be a legitimate response because of the license for these videos? I apologize in advance for the long post but I wanted to give enough context and detail to see if anyone had any insight. I appreciate the help!

UPDATE: I’ve now been able to duplicate this error in all of the latest versions of Firefox, Safari, and Chrome. The steps to reproduce the problem are:

  1. Go to https://www.youtube.com
  2. Search for “Alice Through the Looking Glass (2016)”
  3. Click on the first search result
  4. Rent or Buy the movie
  5. Right-Click on the movie and choose “Copy Embed Code”
  6. Paste into any webpage
  7. Navigate to the webpage. Note: my website uses HTTPS.
  8. HTML5 Player gives the following message “Your browser does not currently recognize any of the video formats available.”
  9. The Iframe quickly loads the Flash Player and gives the following message “An error occurred. Please try again later.”

I’ve been doing some more research and apparently this affects any full length movie purchased from Google Play or YouTube that has been published to YouTube after July 26th 2016. Any movie uploaded to YouTube before that date plays fine. Does anyone have any ideas why the Embeddable Player would not work for purchased content after that date?

来源:https://stackoverflow.com/questions/41269675/licensed-content-doesnt-load-in-embedded-youtube-player

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!