Youtube API Java 客户端库 - 如何检查视频条目是否可用于移动设备?
我有一个用 Java 编写的内容管理服务器应用程序。后台进程会遍历视频 ID 列表,并使用 Youtube API 获取这些视频 ID 的详细信息。 我想检查某个特定视频条目是否适用于移动设备。 我检查了允许的辛迪加,例如
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");
}
检查辛迪加仍然没有解决问题,并且服务器仍然允许无法在 Android 手机上播放的视频。 仅过滤可以在移动设备上播放的视频的正确方法是什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有单一的检查来确定视频是否可以“在移动设备上”播放。
特定视频可能无法在特定平台上播放的原因有多种,不幸的是,绝对确定特定视频是否会在特定播放器中播放的唯一方法是尝试播放它。
话虽这么说,这篇博客文章更详细地介绍了突然出现的常见播放限制类型:http://apiblog.youtube.com/2011/12/understanding-playback-restrictions.html
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