如何在 Android 上的 GLSurfaceView 上播放视频?
我从 ApiDeoms 添加了一个 SurfaceView 到 Cube 演示中。 并尝试使用 MediaPlayer 来播放它。 但它因低级播放器错误而失败,该错误在不同设备上有所不同。 是否可以在 GLSurfaceView 上播放视频,或者这完全取决于硬件支持?
I added a SurfaceView into the Cube demo from the ApiDeoms.
And tried to use a MediaPlayer to play with it.
But it failed with low-level player error which is different on different devices.
Is it possible to play videos on a GLSurfaceView or it's all about hardware support?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
说“如果在设备上失败,则该设备不支持它”。考虑到您向处于演示级别的人提供建议,并且可能不知道这些留言板中充斥着那些“回答”问题而不知道他们在说什么的人,这是相当不负责任的。
这个问题的简短回答
您可能会遇到数百种不同的错误,但是对于“是否可以在 GLSurfaceView 上播放视频”
就是“是的”。如果您的设备兼容 OpenGL(如果它是近十年生产的,那么这是一个安全的选择),那么您可以用它以某种形式显示视频。如果您想要更丰富的答案,那么您将必须提供更多信息,至少准确说明错误是什么,最好是一些 logcat 输出。
To say "If it failed on a device, the device does not support it." is pretty irresponsible considering you're giving advice to people who are at the demo level and might not know how infested these message boards are with people who "answer" questions without having a clue what they are talking about.
There are hundreds of different errors that you could be experiencing, however the short answer to the question:
"Is it possible to play videos on a GLSurfaceView"
would simply be "yes it is". If your device is OpenGL compliant (pretty much if it was built this decade then that's a safe bet), then you can display video in some form or another with it. If you want a more informative answer however you're going to have to provide quite a bit more information, at the very least exactly what the errors are and ideally some logcat output.
我发现这取决于本机解码器支持。
如果在设备上失败,则该设备不支持它。
I found out that depends on native decoder support.
If it failed on a device, the device does not support it.