Detailed explanation of Android multimedia class videoview

1、 Overview

Videoview class integrates video display and control. We can use it to complete a simple video player. Videoview and mediaplayer are similar.

2、 How to use videoview

It mainly has the following common methods

Steps:

1. Specify the path of the video file. 2. Next, call the start () method to start playing the video. The pause () method will pause playing and the resume () method will replay

Note: runtime permission is also required to obtain video files, and all relevant logic needs to be written. Finally, don't forget to declare the permissions used in the androidmanifest. XML file

The following is a simple demo of playing, pausing and replaying

1、 Code in XML file

2、 Code in activity

3、 Declare permissions

Videoview is not a universal video playback tool class. If you use it, it is unrealistic to write a very powerful video player. Videoview is applicable to the title animation of some games or the video publicity of an application.

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
分享
二维码
< <上一篇
下一篇>>