问题描述
我正在开发用于播放 YouTube 视频的 Windows Mobile 6(或也许 5)应用程序.好吧,它应该播放 YouTube 视频(并控制/查询播放器的状态变化、当前帧/时间等)
I am working on an application for Windows Mobile 6 (or maybe 5) that plays YouTube videos. Well, it should play YouTube videos (and control/query the player about status changes, current frame/time, etc.)
在网上搜索了相当长的一段时间(并进行了几次尝试)后,我仍然找不到这样做的方法.我知道的选项是:
After scouring the web for quite some time now (and a few trials), I still couldn't find a way to do this. The options I know of are:
使用嵌入在 HTML 中、可通过 JavaScript 控制的 YouTube 播放器.但是,我无法从 IE Mobile 观看 YT 视频,首先 - 我收到一条错误消息,内容类似于您需要启用了 Flash Player 8 和 JavaScript 的浏览器".
Use the YouTube player, embedded in HTML, controllable via JavaScript. However, I couldn't watch YT videos from IE Mobile, to begin with -- I get an error message saying something along the lines of "you need a browser with Flash Player 8 and JavaScript enabled".
托管媒体播放器控件,但 WMP 拒绝播放 YT 视频,包括移动格式.
Host a Media Player control, but WMP refuses to play YT videos, including the Mobile format.
使用 DirectShow.我仍在研究这个(我以前从未使用过 COM,更不用说 DirectShow),但我还没有找到支持 YouTube 的格式
Use DirectShow. I'm still looking into this one (I've never worked with COM, let alone DirectShow, before), but I am yet to find a solution that supports YouTube's format(s)
我宁愿用 C# 编写这个应用程序,但 C++ 也可以.
I would rather write this application in C#, but C++ works, too.
帮助我,StackOverflow 的智者!
Help me, O Wise Sages of StackOverflow!
推荐答案
您还可以将 YouTube 视频抓取为 MP4,希望能扩展您的播放器选项.您可以查看 DirectShow CF 的播放功能,或者在您的应用中托管其他一些支持 MP4 或 FLV 的播放器.
You can also grab YouTube videos as MP4, hopefully that expands your player options. You can look into DirectShow CF for playback functionality, or host some other player in your app that supports MP4 or FLV.
尝试通过移动 IE 播放它不起作用,因为支持视频播放的 Flash 插件所需的版本不可用(我上次检查过).
Trying to play it back through IE mobile won't work, as the version necessary of the Flash plug-in with video playback support isn't available (last time I checked).
要获取 MP4 文件,请向此 URL 发出请求:
"http://www.youtube.com/get_video?video_id=" +videoID + "&t=" + 令牌 + "&fmt=18"
"http://www.youtube.com/get_video?video_id=" + videoID + "&t=" + token + "&fmt=18"
要获取 FLV,请使用:
"http://www.youtube.com/get_video?video_id=" +videoID + "&t=" + 令牌
"http://www.youtube.com/get_video?video_id=" + videoID + "&t=" + token
要获取令牌,请调用:
"http://www.youtube.com/api2_rest?method=youtube.videos.get_video_token&video_id=" + videoID
"http://www.youtube.com/api2_rest?method=youtube.videos.get_video_token&video_id=" + videoID
我编写了一个应用程序,可以抓取 YouTube 视频的播放列表并将它们与我的 PocketPC 同步,我使用 TCPMP 和 Flash 插件来播放视频(从我的应用程序外部).虽然 MP4 也适用于 PPC,但我坚持使用 FLV,因为当时 YouTube 上的某些视频无法作为 MP4 使用.我现在不会担心这个.
I wrote an app that would grab a playlist of YouTube videos and sync them up with my PocketPC, I used TCPMP with the Flash add-on to playback the video (externally from my app). Although MP4 also worked on the PPC, I stuck to FLVs because at the time some videos on YouTube were not available as MP4. I wouldn't be concerned about this now.
遗憾的是我的 PPC 坏了,现在我在 iPhone 上做了类似的事情,但我不得不完全切换到 MP4 格式.VLC 在 iPhone 上的 FLV 播放对我来说太生涩了.
Sadly my PPC broke, now I'm doing something similar on my iPhone but I had to switch completely to the MP4 format. VLC's FLV playback on the iPhone was too jerky for me.
这篇关于在 Windows Mobile 应用程序中播放 YouTube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!