Summary of common problems in Android video playback

Video playback is a common problem in Android development. In conventional videos, you can directly use videoview + mediacontroller or mediacontroller + serfercie holder

Common problems

1 how to deal with the horizontal screen switching of the player and the layout change of the copy display on the player during playback

Set in activity

In this way, the activity will not be rebuilt during rotation

Rewriting system method

Judge whether the current screen is horizontal or vertical by judging newconfig.orientation. This is to judge whether it is horizontal or vertical during watching the video. You can also judge when our door starts playing the video. The specific processing method is

When changing the layout of the player, we can change it dynamically

This is vertical screen processing

This is horizontal screen processing

We know that the videoview control of the system comes with progress bars such as play and pause. This is mediacontroller. When we click with our hand, the progress bar will be displayed. When our hand leaves the interface, it will not be displayed. This is the method in videoview

Look down again

The final call is mmediacontroller. Hide(); And mmediacontroller. Show(),

Therefore, if we implement our own layout and player progress bar in our player interface, we can rewrite the hide () and show () methods

The above is a summary of the common problems of Android playing video introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message. Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>