I want to detect whether a video is playable or not outside from Youtube. I am currently detecting copyright infringement, embeddable and "syndicatable" restrictions. I am calling twice the API, once in version 3 and once in version 2 with these:
http://gdata.youtube.com/feeds/api/videos/{videoId}?v=2&alt=jsonc
https://www.googleapis.com/youtube/v3/videos?id={videoId}&key={key}&part=status
For the video ( https://www.youtube.com/watch?v=TzmyOT1kcfc ) , I get these answers:
{
"kind": "youtube#videoListResponse",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/yoB7kT2xS4cnv1zDF-EiUrfidKQ\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/mk9sFeT7lpR0qthcrYeJssWlayY\"",
"id": "TzmyOT1kcfc",
"status": {
"uploadStatus": "processed",
"privacyStatus": "public",
"license": "youtube",
"embeddable": true,
"publicStatsViewable": true
}
"player": {
"embedHtml": "<iframe type='text/html' src='http://www.youtube.com/embed/TzmyOT1kcfc' width='640' height='360' frameborder='0' allowfullscreen='true'/>"
}
}
]
}
And :
{
"apiVersion": "2.1",
"data": {
"id": "TzmyOT1kcfc",
"uploaded": "2014-08-07T11:13:03.000Z",
"updated": "2014-09-22T01:13:46.000Z",
"uploader": "topgear",
"category": "Autos",
"title": "Aston Martin: DBS vs DB9 and Vanquish (HQ) - Top Gear - Series 10 - BBC",
"description": "Jeremy test drives the flashy Aston Martin DBS. Clip taken from series 10, episode 6.\n\nSubscribe for more awesome Top Gear videos: http://www.youtube.com/subscription_center?add_user=Topgear\n\nTop Gear YouTube channel: http://www.youtube.com/topgear\nTopGear.com website: http://www.topgear.com\n\nTop Gear Facebook: http://www.facebook.com/topgear\nTop Gear Twitter: http://twitter.com/BBC_topgear\n\nThis is a channel from BBC Worldwide who help fund new BBC programmes.",
"thumbnail": {
"sqDefault": "http://i.ytimg.com/vi/TzmyOT1kcfc/default.jpg",
"hqDefault": "http://i.ytimg.com/vi/TzmyOT1kcfc/hqdefault.jpg"
},
"player": {
"default": "http://www.youtube.com/watch?v=TzmyOT1kcfc&feature=youtube_gdata_player",
"mobile": "http://m.youtube.com/details?v=TzmyOT1kcfc"
},
"content": {
"1": "rtsp://r6---sn-5hn7su7k.c.youtube.com/CiILENy73wIaGQn3cWQ9ObI5TxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp",
"5": "http://www.youtube.com/v/TzmyOT1kcfc?version=3&f=videos&app=youtube_gdata",
"6": "rtsp://r6---sn-5hn7su7k.c.youtube.com/CiILENy73wIaGQn3cWQ9ObI5TxMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"
},
"duration": 438,
"aspectRatio": "widescreen",
"rating": 4.917057,
"likeCount": "2928",
"ratingCount": 2990,
"viewCount": 320436,
"favoriteCount": 0,
"commentCount": 143,
"accessControl": {
"comment": "allowed",
"commentVote": "allowed",
"videoRespond": "moderated",
"rate": "allowed",
"embed": "allowed",
"list": "allowed",
"autoPlay": "allowed",
"syndicate": "allowed"
}
}
}
So what I see is that the video is both "syndicatable" (viewable on mobiles) and embeddable, but it is NOT embeddable ( https://www.youtube.com/embed/TzmyOT1kcfc?autoplay=true ==> refresh the page). The video is playing in my Android app because I'm using the official Youtube SDK so I'm guessing that, for Google, this part of my application is part of Youtube.
The question is: why in both calls, the API tells me that it is embeddable while it is definitely NOT?
I found that I can look for the class "ytp-error html5-stop-propagation" in the HTML returned by launching the embedded player with "autoplay=true" as a parameter, but it will be really expensive to parse the HTML for each Youtube video. Do you have an other way to find out if a video is really embeddable?
Last question: I click on the embedded player I provided you on this topic, it's working the first time but not when you refresh the page. Why?