YouTube iOS SDK: correct GTLQueryYouTube parameters to filter out videos which can't be played on mobile?

后端 未结 2 832
天命终不由人
天命终不由人 2021-01-25 21:28

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 pa

相关标签:
2条回答
  • 2021-01-25 21:36

    One possible solution (admittedly, not very elegant) is to make two GTLQueryYouTube calls:

    1. videoSyndicated off (or set to all): search for the keyword "VEVO" in the description field of GTLYouTubeSearchResultSnippet, return top search result

    2. videoSyndicated on (set to true): 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).

    0 讨论(0)
  • 2021-01-25 22:02

    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:

    1. lWA2pjMjpBs has autoplay disabled which may explain the problem you are seeing: http://gdata.youtube.com/feeds/api/videos/lWA2pjMjpBs?v=2&prettyprint=true. We don't return the autoplay restrict in v3 responses yet but will follow up with the team on that.
    2. 3BwfuFuYOWE has syndication disabled. In v2 you can see it here: http://gdata.youtube.com/feeds/api/videos/3BwfuFuYOWE?v=2&prettyprint=true, but in v3 we only expose it via a search restrict. I'll follow up with the team on this as well so it is easier to see that in the videos.list response.
    0 讨论(0)
提交回复
热议问题