I'm trying to find the right GTLQueryYouTube parameters to filter out videos which can't be played on mobile (in an iOS UIWebView). The videoEmbeddable and videoSyndicated params are too restrictive (they filter out all VEVO videos).
In our iOS app, we search for YouTube videos via GTLQueryYouTube, leaving the videoEmbeddable and videoSyndicated parameters blank.
This returns Vevo videos which are generally playable in the UIWebView. For example "Rihanna - Diamonds" (lWA2pjMjpBs) is playable. It can't be played in an embedded view.
Some videos, however can't be played. For example "Lana Del Rey - Gods and Monsters" (3BwfuFuYOWE) can't be played in the UIWebView. The YouTube page loads, but instead of playing the video I see an error "The content owner has not made this video available on mobile."
We want to filter out these non-playable videos when searching. The GTLQueryYouTube API only supports filtering for "videoEmbeddable" and "videoSyndicated", neither of which correctly filter out the Lana Del Rey video, but leave in the Rihanna video.
It seems like there's a missing filter parameter to filter out these types of videos. Inspecting the metadata doesn't reveal any noticeable difference between the Rihanna and Lana Del Rey videos.
Ideas?
One possible solution (admittedly, not very elegant) is to make two
GTLQueryYouTube
calls:videoSyndicated
off (or set toall
): search for the keyword "VEVO" in the description field ofGTLYouTubeSearchResultSnippet
, return top search resultvideoSyndicated
on (set totrue
): best search result (with appropriate filters of your choice).If the first query returns a null result, then you assume that there is no VEVO video, and you use the next best playable video (2).
In general there is no way to determine all playback restrictions using the API, unfortunately. We have a guide for API v2 here: http://apiblog.youtube.com/2011/12/understanding-playback-restrictions.html but no similar resource for v3 yet.
I'd recommend using the (videoEmbeddable and videoSyndicated) search restricts since this is what they're designed for. One approach is to take the user to m.youtube.com for playback of videos that are restricted from 3rd party apps. Alternatively, you can try to approach the content owner and persuade them to change the config of the content (since this is something YouTube enforces but does not configure).
About the videos you have listed specifically: