使用黑莓模拟器流式传输视频
因此,我为 iPhone 编写了一个快速的小应用程序,它接收一个 http URL,并播放位于该 URL 的 .mp4 视频。当然,它的作用远不止这些,但这就是它的核心。当然,我希望它不仅仅出现在一个移动平台上,所以我决定下一步瞄准黑莓。
然而,我在使用 BlackBerry Environment 时遇到了很多问题。首先,我得知我只能下载 256k 文件!我了解了如何在 MDS 模拟器中设置该变量,并且了解到这不是生产解决方案,因为任何最终用户都必须让其 BES 或 MDS 管理员更改那里的设置。然后,我找到了一个小于 2 MB 的视频可以练习。转到浏览器会提示我保存视频,而不是像我预期的那样在浏览器中播放。保存视频后,它拒绝播放,说格式错误。
所以。我找不到有关 BlackBerry 是否可以使用 HTTP 进行流式传输的参考。不过,我听说它可以使用 RTSP,并且听到一些传言说它不能使用 HTTP,这真的很糟糕。我也找不到黑莓使用的格式的参考,尽管我可以找到一百万个将一个文件转换为“黑莓”格式的程序。
肯定有人以前尝试过用黑莓手机传输视频。他们是如何着手这样做的?难道这只是一个无望的白日梦?我必须使用 RTSP 吗?
抱歉缺少具体问题。我真的迷失了,我讨厌这么多教程或论坛帖子似乎假设我了解黑莓的功能。
编辑:我终于发现黑莓使用的是我从未听说过的.3gp 格式。不过,仍然不知道如何从网络上流式传输视频。我发现 “如何 - 在 BlackBerry 智能手机应用程序中播放视频” 这看起来很有用,但如果您给它一个 URL,代码就不起作用,尽管它声称可以。
So, I wrote a quick little app for the iphone that takes in an http URL, and plays the .mp4 video located at that URL. It does more than that, of course, but that's the meat of it. Naturally, I wanted to have it on more than just a single mobile platform, so I decided to target BlackBerry next.
However, I'm running into a lot of problems with the BlackBerry Environment. First of all, I learn that I can only download 256k files! I learn how to set that variable in my MDS simulator and I learn that this is NOT a production solution, because any end users will have to have their BES or MDS admin change the setting there. Then, I find a video less than 2 MB I can practice with. Going to the browser prompts me to save the video rather than it playing in the browser like I expected. After saving the video, it refuses to play, saying it's the wrong format.
So. I can't find a reference to whether BlackBerry can stream with HTTP. I've heard it can use RTSP, though, and heard some rumors that it can't use HTTP, which would really suck. I also can't find a reference to what format BlackBerry uses, although I can find a million programs that will convert one file to the 'BlackBerry' format.
Surely SOMEONE must have tried to stream video with the BlackBerry before. How did they go about doing so? Is it just a hopeless pipedream? Will I have to go with RTSP?
Sorry for the lack of a concrete question. I'm just really lost, and I hate how so many tutorials or forum posts seem to assume I know the capabilities of the Blackberry.
Edit: I finally found out that the .3gp format, which I'd never heard of, is what BlackBerry uses. Still have no idea how to stream videos off the web, though. I found "How To - Play video within a BlackBerry smartphone application" That seemed useful, but the code doesn't work if you give it a URL, even though it claims it does.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然您正确地认为本教程声称代码将加载任何有效的 URL,但 javax.microedition.media.Manager.createPlayer 的 API 文档指定了“描述媒体内容的 URI 语法中的定位器字符串”,实际上可能不是与任何有效的 URL 相同。幸运的是,createPlayer 还将采用一个 InputStream 和一个指定内容类型的字符串。因此,您应该能够打开 HttpConnection API 中记录的 URL,获取内容类型字符串,然后打开输入流来创建播放器。
我承认我还没有这样做,但这将是我的下一步。
顺便说一句,请记住在与应用程序事件线程分开的线程上运行 HttpConnection 获取。
While you are correct that the tutorial claims the code will load any valid URL, the API documentation for javax.microedition.media.Manager.createPlayer specifies "A locator string in URI syntax that describes the media content" which may not, in fact be the same as any valid URL. Luckily createPlayer will also take an InputStream and a String specifying the content type. So you should be able to open the URL as documented in the API for HttpConnection, grab the content type string, and open the input stream to create the player.
I will admit that I haven't done that, but it would be my next step.
BTW remember to run your HttpConnection fetch on a thread separate from the application event thread.