在Android中播放RTSP流媒体视频时如何保持宽高比?
我有一个流式 RTSP 视频链接,我正在 VideoView 的帮助下播放它。在肖像模式下,视频分辨率和宽高比非常完美。但当我尝试切换到横向模式时,视频会拉伸并且看起来被拉长。这极大地扭曲了质量。
- 有关如何使视频视图在两种方向模式下保持相同的宽高比的任何提示?
- 如果我需要编写自己的媒体播放器来扩展 VideoView .. 我应该如何重写 onMeasure(...) 才能正确渲染视频?任何示例都会有很大帮助,因为 Android 开发人员网站上的文档有限
- 如何查找通过 RTSP 接收的视频的大小?这样我们就可以将视频视图设置为该大小?
如果有任何建议,我愿意倾听,因为我对媒体 API 还很陌生......
I have a streaming RTSP video link which I am playing with the help of VideoView. In the portrait mode the Video resolution and aspect ratio is perfect. But when I try switching to the landscape mode the video stretches and looks elongated. This distorts the quality to a great deal.
- Any tips of how to make the videoview to maintain the same aspect ratio in both orientation modes?
- If i need to write my own media player extending the VideoView .. How exactly should I override the onMeasure(...) to render the video properly? any example will be of great help coz of the limited documentation on android developer site
- How to find the size of the video received through RTSP? so that we can set the videoview to that size?
If any suggestions I am open to listen as I am quite new to the Media API....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常是这样。例如,此项目在本地测试中可以正常运行。 mp4 文件(在外部存储的根目录中)纵向和横向,同时保持宽高比。
It normally does. This project, for example, works properly with a local test.mp4 file (in the root of external storage) in portrait and landscape, while maintaining aspect ratio.