Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that Android can't play this video when using VideoView?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "Android using VideoView can not play this video how to solve", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Android using VideoView appears can not play this video how to solve" it!

The steps to play a video using VideoView are as follows:

1) define the VideoView component in the interface layout file, or create the VideoView component in the program.

2) call the following two methods of VideoView to load the specified video.

SetVideoPath (String path): loads the video represented by the path file.

SetVideoURI (Uri uri): loads the video corresponding to uri.

3) call the start (), stop () and pause () methods of VideoView to control video playback.

In fact, there is a MediaController class used in conjunction with VideoView-, which provides a friendly graphical control interface through which video playback can be controlled.

This article mainly introduces the solution that Android can not play this video with VideoView. Let's take a look at the detailed introduction.

Find a problem

Needless to say, the problem encountered this time is that I can't play this video + black screen. The problem is as follows

This problem has been sent to me for more than a day, and I can't find a solution on the Internet. The boss is anxious, so am I.

That's what I wrote. It couldn't be simpler.

Uri uri = Uri.parse ("http://pic.ibaotu.com/00/20/08/96e888piCHck.mp4");Log.i("Video"," video:-- > > "+ uri); vh.leftVideo.setMediaController (new MediaController (mContext)); vh.leftVideo.setVideoURI (uri); / / play network video / / 4.4 start playing vh.leftVideo.start (); / / 4.5 get focus vh.leftVideo.requestFocus ()

Cause analysis:

Many people will think that it is possible that there is no permission to add, or because of equipment problems and so on. But I made a low-level mistake this time.

As the background of the company has not yet achieved the video upload function, and I am in a hurry to play the video, then I went to Baidu to find video material, and the result is that I refused to come out. Finally, and by chance, I saw a video playback written by my former colleague in other projects in the company. The key point was that I changed its video path, and it miraculously played.

Encounter this kind of problem, the video had better be uploaded by oneself, do not use the video material on the Internet, the video material on the Internet has done the measure of protection. Another way is to use local video.

Thank you for your reading, the above is the "Android using VideoView can not play this video how to solve" the content, after the study of this article, I believe you can not play this video on the use of Android VideoView how to solve this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report