我正在为我经常访问的多媒体网站编写应用程序,但遇到了一个问题。
After grabbing a video stream URL (h264 wrapped in an mp4 container) and attempting to play it with the native video player, it fails.
这是在我的 Moto Droid 上运行 2.2 (BB) 和 2.3 (CM7)。我已经在我的 Xoom(3.1 股票)
上测试了该应用程序,它运行良好。
我还有一个 friend 在她的 Xperia Arc
(据我所知是 2.3 库存)上测试过它并且对她有效。让我认为这是一个硬件解码器问题,因为我可以使用 RockPlayer 的软件解码器
正常播放流,但不能使用硬件解码器。
所以我想知道三件事:
- Does the native Android player support software decoding. if so, how do I tell if it's using hardware or software and is it possible to toggle?
- are there any 3rd part media players with readily available SDKs (free).
- How can I just open the video in another app like Rock Player since I know it works. When I download a video using the browser, it asks me what video player I want it to use. How can I get this to pop up within my app and then send the video to it?
最佳答案
是的,Android 提供软件 h264 解码器,但在 2.2 中可能不可用。您可以更喜欢软件编解码器,请参阅 stagefright 的 AOSP 源代码:
usage: stagefright [options] [input_filename] … -s(oftware) prefer software codec …
ffmpeg 在 Android 上有许多衍生品和包装器,它们在各种许可限制下可用。
启动针对特定应用的 Intent 非常容易。您可以使用 setComponent()以完全匹配您需要的 Activity 。处理该问题的更好和更灵活的方法是创建一个自定义选择器(参见例如 Custom filtering of intent chooser based on installed Android package name ),让用户决定她/他喜欢哪个播放器。使用自定义选择器,您可以决定隐藏一些注册到 Action 的处理程序(例如,不使用 Android 3.0 以下版本的系统播放器)。
关于Android Dev - 第 3 方媒体播放器 SDK 或其他选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6303893/