如何确保 YouTube API 只返回可在 iPhone 上流式传输的视频?
我正在将一些 YouTube 搜索功能构建到 iPhone 应用程序中,并希望确保我只收到可在设备上播放的结果。根据API 参考文档中的搜索视频部分这似乎相对简单:
格式参数指定视频必须以特定视频格式提供。您的请求可以指定以下任意格式:
我已尝试设置“format=1”以限制为:
用于移动视频播放的 RTSP 流媒体 URL。 H.263 视频(高达 176x144)和 AMR 音频。
这提供了很高比例的可播放视频,但有些仍然无法播放,我担心它不会返回其他可播放的视频。
当我将格式字段留空时,我会收到更高比例的不可流式 URL。
I'm building some YouTube search functionality into an iPhone app and want to ensure that I only receive results that will be playable on the device. According to the Searching for videos section in the API reference doc this seems to be relatively straightforward:
The format parameter specifies that videos must be available in a particular video format. Your request can specify any of the following formats:
I've tried setting "format=1" to limit to:
RTSP streaming URL for mobile video playback. H.263 video (up to 176x144) and AMR audio.
This provides a high proportion of playable videos but some are still unplayable and I'm worried that it's not returning others that would be playable.
When I leave the format field blank I receive an even higher proportion of non-streamable URLs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(2)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
这听起来不太合适。我的理解是,iPhone 不流式传输 RTSP,而是支持 Apple 的分段文件的 HTTP 流式传输,以通过范围请求进行直播和 MPEG4 视频文件的 HTTP 流式传输。我还希望视频是 H.264 和 AAC 音频。
您的设置听起来适合低端手机。特别是,176x144 是非智能手机上常用的 QCIF 分辨率。
This does not sound appropriate. My understanding is that iPhone does not stream RTSP rather it supports Apple's HTTP Streaming of segmented files for live and HTTP streaming of MPEG4 video files via range requests. I'd also expect the video to be H.264 and AAC audio.
Your setting sounds appropriate for low-end cellphones In particular, the 176x144 is a QCIF resolution commonly used on non-smartphones.