媒体播放器屏幕旋转问题
我制作了一个媒体播放器,并在 onSurfaceCreated() 方法中调用了 setDataSource()、setDisplay() 和prepare() 方法。第一次渲染视图时,一切工作正常,如果我旋转屏幕,显示就会消失,只有音频可用。我该如何让它工作?我使用视频视图来显示视频。请帮我解决这个问题。
i have made a media player and have called setDataSource(), setDisplay() and prepare() methods in onSurfaceCreated() method. Everything works fine when the view is rendered for the first time, if i rotate the screen, display disappears and only audio is availaible.How would I get it working? I have used video view for displaying video. Please help me with this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从您的问题中我可以看到您正在使用表面视图,当您旋转屏幕时,该视图将重新启动。因此,您必须根据您的要求将屏幕模式设置为横向或纵向。
否则,除了使用表面视图之外,您还必须找出其他方法。
From your question I can see that you are using a surface view which will re initiate when you rotate your screen. so you must set your screen mode to either landscape or portrait based on your requirement.
Else you must figure out some other way other than using surface view.
当您旋转屏幕时,Activity 会被销毁,并会创建一个具有不同配置的新 Activity。如果某些功能不起作用,则意味着您应该在横向模式下测试您的应用程序。
When you rotate the screen, Activity gets destroyed and a new one is created with a different configuration. If something doesn't work, it means that you should test your application in the landscape mode.