从 YouTube API 仅检索支持移动设备的视频 [英] retrive only mobile-supported video from YouTube API

查看:15
本文介绍了从 YouTube API 仅检索支持移动设备的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 YouTube API 为 Android 客户端检索视频.

该程序运行良好,但有时我会收到不允许在智能手机上播放此视频"之类的错误.

那么,有没有办法过滤这些视频?我阅读了 此文档,但没有找到解决方案.

解决方案

有两个概念可嵌入和联合.iOS 设备使用 iframe,因此它们基本上是嵌入的.使用播放器 API 的 Android 设备可以检查联合.

当您执行 search->list 时,您可以设置videoEmbeddablevideoSyndicated 为 true.

对于 Android,您应该检查 videoSyndicated.p>

或者,如果您正在遍历视频,对于每个视频,您可以执行 video->list 使用视频 ID 调用并检查 status.embeddable 在响应中.

这里有一篇关于此主题的博文,甚至尽管示例在 v2 中,但信息仍然相关.

I'm using the YouTube API to retrieve videos for and Android client.

The program works well but sometimes I get an error like "this video is not allowed to run on smartphones".

So, there is a way to filter that videos? I read this doc but did not find a solution.

解决方案

There are two concepts embeddable and syndicated. iOS devices use iframe so they basically embed. Android devices that use player API can check syndicated.

When you do a search->list, you can set videoEmbeddable and videoSyndicated to true.

For Android, you should check videoSyndicated.

Or if you are iterating through videos, for each video, you can do a video->list call with video id and check status.embeddable in the response.

Here is a blog post about this topic, even though examples are in v2, information is still relevant.

这篇关于从 YouTube API 仅检索支持移动设备的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆