This article illustrates the problem of video files in Android playback assets files. Share to everyone for your reference, specific as follows:
Today did a function, is to play the project inside the video file, not playing SD card video files.
I started trying to put the video files in the assets file directory.
This is because it was written before WebView loaded the assets folder:
WebView = new WebView (this);
Webview.loadurl (file:///android_asset/sample3_8.html);
And so on, I try to put the video video.3gp in the assets directory and write the following code:
Intent it = new Intent (intent.action_view);
Uri uri = uri.parse (name);
It.setdataandtype (URI, "video/3gp");
StartActivity (IT);
Launched the Android player, prompting for some information (not logged), presumably means that the file cannot be played on the path below/Unable to find the path file.
Google a bit, the Chinese web page there is little solution to the explanation, according to the Convention, to http://stackoverflow.com search answers, found this post:
I want to play a video from my assets or raw folder into my app Inandroid
The final solution to the video files in the Android Project project is:
1. Put the video file under the Res/raw file of Project engineering.
2. The video file must be an Android support video format (3GP,WMV,MP4), and the name must be lowercase, data, underscores, for example: My_video_file.mp4
3. When you refer to this resource file in your code, you must use the Rstatics class and remove the suffix of the file: R.raw.my_video_file
4. This activity class should have a helper method Getpackagename () that makes it easier for you to construct the correct URI in your code.
Videoview vv = (videoview) This.findviewbyid (R.id.videoview);
String uri = "android.resource://" + getpackagename () + "/" + R.raw.my_video_file;
Vv.setvideouri (Uri.parse (Uri));
Vv.start ();
For more information on Android-related content readers can view the site: "Android Multimedia application Development Skills Summary", "Android Development introduction and Advanced Course", "Android debugging techniques and common problems solution summary", " Android Multimedia How-to Summary (audio, video, audio, etc), summary of Android Basic components usage, Android View tips Summary, Android layout layout tips and a summary of Android controls usage
I hope this article will help you with the Android program.