Video files such as MP4 and 3GP loaded in Android cannot be played.

Source: Internet
Author: User

Let me go and finally solve this problem.

When loading a video file in the android simulator, it will prompt: the video cannot be played! Therefore, I found the error log under logcat, which has the following lines of error display:
Error/playerdriver (31): Command player_prepare completed with an error or info
Pvmferrresource

: Error/mediaplayer (19049): Error (1,-17)

: Error/mediaplayer (19049): Error (1,-17)

Yesterday, I repeatedly searched,CodeNo error. It will happen at half past one. I chose to temporarily give up and put it aside. I checked some information on the Internet and could not find a solution to the problem. Today, I opened it again and looked at some source code. I tried to add the following code in the main. xml configuration information in the layout Folder:

<Textview

Android: layout_width = "fill_parent"

Android: layout_height = "wrap_content"

Android: text = "@ string/hello"

/>

Yes, it is fixed. Due to limited capabilities, I can only make the following understandings and explanations. If you have any different or better insights, I hope to raise them. The following is my main. xml configuration file:

 

<Framelayout

Xmlns: Android = "http://schemas.android.com/apk/res/android"

Android: layout_width = "fill_parent"

Android: layout_height = "fill_parent">

<Textview

Android: layout_width = "fill_parent"

Android: layout_height = "wrap_content"

Android: text = "@ string/hello"

/>

<Videoview

Android: Id = "@ + ID/video"

Android: layout_height = "wrap_content"

Android: layout_width = "wrap_content"

Android: layout_gravity = "center"/>

</Framelayout>

Since I am using the framelayout layout, we may wish to use framelayout as a canvas, fixed from the upper left corner of the screen to fill in images and text. For example, myProgramTo display the video file, I first display the text file, then fill in my video file, overwrite the former, and display it to the client.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.