Copy and retrieve thumbnails of multimedia files in the raw folder in Android
1. multimedia files in the raw folder
Get the input stream of the test file in this folder
InputStream is = getResources (). openRawResource (R. raw. test );
Obtain the file name.
String fileName = getResources (). getResourceName (R. raw. test); (package name + file name)
2. For the first installation, write the file to the SD card
SD card read and write permissions:
<! -- Create and delete file permissions in SDCard -->
<Uses-permission android: name = "android. permission. MOUNT_UNMOUNT_FILESYSTEMS"/>
<! -- Write data to SDCard -->
<Uses-permission android: name = "android. permission. WRITE_EXTERNAL_STORAGE"/>
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0950153296-0.png "title =" raw.png "alt =" 175759743.png"/>
3. Use the VideoView control to play the video file.
Mview. setVideoPath ("file path"); // sets the file path
Mwebview. requestFocus ();
Mwebview. start (); // playback
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0950151V0-1.png "title =" videoview.png "alt =" 180409355.png"/>
Playback controller.
4. Obtain an image in the video file as a thumbnail.
When obtaining thumbnails, use the file path on the SD card. I use the uri of the raw file "android: resource //" + package name + R. raw. test. Therefore, use the path of the SD card ("/mnt/sdcard/xx.mp4 ").
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0950156003-2.png "title =" bitmap.png "alt =" 180819353.png"/>
5. Display thumbnails. Remove the thumbnails during playback and display the VideoView control.
This article is from the "tagmic" blog, please be sure to keep this source http://6315712.blog.51cto.com/6305712/1296613