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:
Go to https://www.youtube.com
Search for “Alice Through the Looking Glass (2016)”
Click on the first search result
Rent or Buy the movie
Right-Click on the movie and choose “Copy Embed Code”
Paste into any webpage
Navigate to the webpage. Note: my website uses HTTPS.
HTML5 Player gives the following message “Your browser does not currently recognize any of the video formats available.”
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?
Related
So I got the new API cURL working for me for requesting video informations, I want to get the "licensed" info, tried with a music video, it worked, here.
My problem here is that I even tried it with a normal video, I got the same "licensedContent": true How can I detect if the music video is actually licensed?
For an example here is shakira's song and the description of the license here.
Disclaimer:
The following answer isn't complying with the YouTube operational API specification, you should instead follow my other StackOverflow answer on enumerating the musics in the given video. That way by checking whether or not the video contains musics you can deduce if the video is licensed or not.
Deprecated answer:
One more time YouTube Data API v3 doesn't provide a basic feature.
I recommend you to use my open-source YouTube operational API. Indeed by requesting https://yt.lemnoslife.com/videos?part=containsMusic&id=VIDEO_ID you'll get the boolean whether or not the video contains a music in item["containsMusic"].
Examples:
Hips don't lie:
https://yt.lemnoslife.com/videos?part=containsMusic&id=DUT5rEU6pqM
(returning "containsMusic": true)
A not music
video:
https://yt.lemnoslife.com/videos?part=containsMusic&id=6ZRgVX8SYX4
(returning "containsMusic": false)
licensedContent
means that the content was uploaded to a channel linked to a YouTube content partner and then claimed by that partner.
https://developers.google.com/youtube/v3/docs/videos#contentDetails.licensedContent
I'm working on a Chrome extension and would like to know if there are still any remains of Flash use in videos on Youtube?
When I checked two weeks ago Flash was still in use for live stream, but when I checked today I was happy to see that the live stream is now also using HTML5.
Now I can't take a risk so I would like to know please if there is still any Flash use somewhere in videos in the YouTube world?
I already spent hours of making my extension to work with the Flash player, so I will save it in the side for just in case, and would like to get rid of all that unnecessary code.
The Flash player has been officially deprecated as of January 27, 2015. So as a developer, you really shouldn't use that API anymore. However, protected videos such as movies or TV shows that use the RTMPE streaming protocol still use the Flash player as a form of DRM.
At the time of writing, the Ghostbusters movie and Twister TV series use the Flash player.
I have already posted two questions
Question 1 Question 2
last week, but no answer worked. I am working on an app(I have completed the UI),
I have to show the youtube videos in the app, just like the youtube app. that is to show youtube videos in the full mode and in half screen too.
Some Body told me to use MPMoviePlayerViewController , but the problem with this player is, that it takes the url of videos like "www.xyz.com/videos.mov". It doesn't play youtube videos. I went to Youtube Developer site. There is lot of information, but all that is for some scripting(javascript using iframe) language, that I don't understand.
Its been a week, and am stuck with this youtube API(I tried to read each and every thing on youtube developer blog, but most of the stuff is related to javascript, which I don't know).
There are few codes available over stackoverflow and Github, which are very old, and are not working now.
If any body know anything then please help. Thanks in advance
I've managed to play YouTube videos with MPMoviePlayerController using LBYouTubeView Library.
Which is a good and upto date library. Basically it extract "www.xyz.com/videos.mov" kind of URL from YouTube and plays in a MPMoviePlayerController. You can also set the quality of the video (low,medium,high) etc. This library comes with a sample project you can test.
I work on an automatically music player. To be short, i use the Last.fm api to get a lot of tracks names and tags. Using these tags and some intelligence computing algorithms, once you play a track, the player sets another track (with tags very appropriate to the tags of the track listened before).
I used the youtube API to search for the URL's of the movies, and I managed to make it work. Now I want to make the videos play on my music player. I have tried to place the youtube player on WebView. It works, but not as intended. I want to control that player. I want it to start playing automatically, and I want to get noticed when the video ended so I can start the next one.
Any clues of what should I do to play the videos from youtube based on the search that uses the Youtube API, and to have control over the youtube player that I place on my GUI(make it play and stop from command line)? Or is there any possible way do download the youtube movie and play it using the JavaFX API? I searched google and noticed I cannot download youtube movie into a format that can be played by JavaFX api.
Update Dec 4th, 2015
Some versions of JavaFX 8 are unable to play back youtube video content. Currently, for instance, Java 8u66 cannot playback youtube video content, but Java 8u72 early access release can.
Also note some of the videos referenced in the sample solution are no longer available or are protected from play in embedded video players. So ensure that you perform any tests using available and videos that have not been distribution restricted. Refer to the youtube documentation for information on distribution restriction if need be.
Any clues of what should I do to play the videos from youtube
As a hints to get you started, see code playing YouTube videos in JavaFX and the YouTube HTML5 api.
Here is the sample code I linked running and playing YouTube videos back within a JavaFX WebView with some (very minimal) control over the video playback via interaction with a JavaFX "New Song" button.
Or is there any possible way do download the youtube movie and play it using the JavaFX API? I searched google and noticed I cannot download youtube movie into a format that can be played by JavaFX api.
I think such a usage would violate YouTube's terms of service. I believe YouTube requires you to play the video back using the YouTube video player (let's them insert ads in the video player etc).
5.1 A
you agree not to distribute any part of or parts of the Website or the
Service, including but not limited to any Content, in any medium
without YouTube's prior written authorisation, unless YouTube makes
available the means for such distribution through functionality
offered by the Service (such as the YouTube Player);
5.1 C
you agree not to access Content through any technology
or means other than the video playback pages of the Website itself,
the YouTube Player, or such other means as YouTube may explicitly
designate for this purpose;
I advanced little, but I got stuck to other problems.
First of all, the code from jewelsea was great. Now I could embed the player into a secondary window of my player and it shows the movie based on the URL that i got using the youtube api. But it looks like JavaFX cannot show most of the movies. It shows me the youtube player and an error message saying that I need to install latest version of Adobe Flashplayer. From my research, I noticed that the webView can only show movies with quality set at 240p, not higher.
I have searched a lot on Google how to make my webView to play the 240p quality video. First of all, i tried to set the youtube query parameters (https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters#formatsp). I tried all the parameters from there: 1,5 and 6. But yet, I did not get the URL of movie with format that can be viewed on the webView of the JavaFX.
I also tried to embed the video quality in the URL of the movie like this:
http:/www.youtube.com/watch?v=og2YZlLhjKs&vq=small:240p ; but it does not work at all. I also wrote that URL in the browser and it looks like the youtube automatically sets the video to the highest quality, no matter what parameter I write in the URL.
The youtube api code that I used is the same like in this webpage: http://www.javacodegeeks.com/2010/05/getting-started-with-youtube-java-api.html
I just moved the main class code to a method that returns the URL of the first video that is in the list, and I changed the " query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT); "
to " query.setOrderBy(YouTubeQuery.OrderBy.RELEVANCE);". And this works fine, it shows the url to proper music videos that I search.
I am sorry for not showing the code of my project but it is big and it contains 2-3 api keys, and if you tell me how to change the video URL http:/www.youtube.com/watch?v=og2YZlLhjKs to work on the code from this website: https:/gist.github.com/jewelsea/1437374 , then I will know that to do to make it work on my project as well;
And the thing about YouTube playback API also enlightened me. I see that API has a lot of functions that could help me to play a lot easier with the video content (make it play, make it stop) but the problem is that I do not have knowledge about javascript programming and it is very sad that I do not have those methods in Java API as well. Maybe I will give it a try and insert javascript code into my webview. But, if I edit the webview using javascript... Is it going to play higher quality movies on the JavaFX webView?
I have a content management server application written in Java. A background process goes through a list of video ids and fetches the details for those video ids using Youtube API.
I would like to check if a particular video entry is available for mobile or not.
I checked syndicate allowed like
String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/"+videoID;
VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
if(!videoEntry.getXmlBlob().getBlob().contains("yt:accessControl permission='denied' action='syndicate'")){
System.out.println("The video is syndicatable");
}
Checking for syndicate still not solved the problem and the server still lets in videos that cannot play on Android phone.
What is the right way to filter only the videos that can be played on mobile?
There's no single check to see whether a video is playable "on mobile".
There are a variety of different reasons why a particular video might not be playable on a particular platform, and unfortunately the only way to be absolutely sure whether a particular video will play in a particular player is to attempt to play it.
That being said, this blog post goes into more details about the types of common playback restrictions that crop up: http://apiblog.youtube.com/2011/12/understanding-playback-restrictions.html