Android - Playing MP4 video file from an expansion file - android

I have followed all the steps in testing an expansion file for my application. Where I am stuck now is how to play a video file contained in that expansion file.
I have successfully been able to download it from Google Play, and I can see it in the folder it is supposed to be in when I browse through my file manager.
I have looked for the past couple of days in trying to figure out how to play the file. At the moment there is only one for, to maintain appropriate size for testing.
I have tried to parse the URI and set it in the videoview, however, it always shows that the video cannot be played.
I have also tried this code so far to access it (as read in the documentation, and I have replaced the parameters with my parameters):
// Get a ZipResourceFile representing a merger of both the main and patch files
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(appContext,
mainVersion, patchVersion);
// Get an input stream for a known file inside the expansion file ZIPs
InputStream fileStream = expansionFile.getInputStream(pathToFileInsideZip);
What do I do with the input stream in order to play the video?

Code for provider
public class EHZipUriProvider extends APEZProvider {
#Override
public String getAuthority() {
// TODO Auto-generated method stub
return "your.package.name.Utility.EHZipUriProvider";
}
}
Custom video player
public static final Uri CONTENT_URI = Uri
.parse("content://your.package.name.Utility.EHZipUriProvider");
public static VideoView mview;
public static void playVideo(Context context, VideoView resource, String VIDEO_NAME) {
position = 0;
mview = resource;
Uri video = Uri.parse((CONTENT_URI + "/" + VIDEO_NAME));
mview.setVideoURI(video);
mview.start();
mview.setOnCompletionListener(new OnCompletionListener() {
#Override
public void onCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub
mview = null;
}
});
}
Calling in activity
VideoPlayer.playVideo(context, vv, "rulesofenglish.mp4");

For example, my application package name is:
com.bluewindsolution.android.sampleapp
Then my expansion file should be
main.1.com.bluewindsolution.android.sampleapp.obb
In detail, you can follow in here:
[main|patch].< expansion-version >.< package-name >.obb
From expansion you can get it via three ways:
via AssetFileDescriptor
// This one works with an image file and a media file.
// Get a ZipResourceFile representing a specific expansion file
// mainContext, version number of your main expansion, version number of your patch
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(this, 1, 0);
AssetFileDescriptor afd_img1 = expansionFile.getAssetFileDescriptor("your_path/your_file.jpg");
AssetFileDescriptor afd_mpbg = expansionFile.getAssetFileDescriptor("your_path/your_file.mp3");
// To set image
ImageView imageView1 = (ImageView)findViewById(R.id.iv1);
imageView1.setImageBitmap(BitmapFactory.decodeFileDescriptor(afd_iv1.getFileDescriptor()));
// To set sound
try {
mpbg.setDataSource(afd_mpbg.getFileDescriptor(), afd_mpbg.getStartOffset(), afd_mpbg.getDeclaredLength());
mpbg.prepareAsync();
mpbg.start();
} catch (IllegalStateException e) {
Log.w("Error=====", "Failed to prepare media player", e);
}
Via InputStream:
// This one works with an image file and a media file.
// Get a ZipResourceFile representing a specific expansion file
ZipResourceFile expansionFile = new ZipResourceFile(filePathToMyZip);
// Get an input stream for a known file inside the expansion file ZIPs
InputStream fileStream = expansionFile.getInputStream(pathToFileInsideZip);
Via Uri
// This one can use in almost thing such as jpg, mp3, mp4, pdf, etc.
// You need to create a new class to override APEZProvider
public class ZipFileContentProvider extends APEZProvider {
#Override
public String getAuthority() {
return "com.bluewindsolution.android.sampleapp";
}
}
// You need to add <provider> in AndroidManifest.xml
<provider
android:name="com.bluewindsolution.android.sampleapp.ZipFileContentProvider"
android:authorities="com.bluewindsolution.android.sampleapp"
android:exported="false"
android:multiprocess="true"
>
<meta-data android:name="mainVersion"
android:value="1"></meta-data>
</provider>
// After that, you can use it any time by this code:
String filename2 = "image/i_commu_a_1_1_1_1.jpg"; // suppose you store put your file in directory in .obb
String uriString2 = "content://com.bluewindsolution.android.sampleapp" + File.separator + filename2;
Uri uri2 = Uri.parse(uriString2);
imageView2.setImageURI(uri2);
// Filename inside my expansion file
String filename = "video/v_do_1_1_1.mp4"; // Suppose you store put your file in directory in .obb
String uriString = "content://com.bw.sample_extension_download_main" + File.separator + filename;
Uri uri = Uri.parse(uriString);
v1 = (VideoView)findViewById(R.id.videoView1);
v1.setVideoURI(uri);
v1.start();

Using a provider (the best solution for me)! I tested it, and it works perfectly.
See Android: read media file from .obb using APEZ.

Related

How to retrieve a particular file in an Android Device?

I have created an Android Application to download an .mp3 file from server and store it in a folder in internal memory. Now I want to fetch that downloaded file and play it for the user.
How can I retrieve that single file and play that file using Media Player .?
Can anyone find me a solution for this ?
For getting the file and changing its Extension this code maybe usefull..
public void jjj(View view) {
File file = new File(Environment.getExternalStorageDirectory().toString() + "/Jithin's/downloadedfile.srt"); // handler to your ZIP file
File file2 = new File(Environment.getExternalStorageDirectory().toString() + "/Jithin's/downloadedfile.mp3");
// destination dir of your file
boolean success = file.renameTo(file2);
//-----------------------------------------------------------------------------------------------------------
final MediaPlayer mp=new MediaPlayer();
try{
//you can change the path, here path is external directory(e.g. sdcard) /Music/maine.mp3
mp.setDataSource(Environment.getExternalStorageDirectory().getPath()+"/Jithin's/downloadedfile.mp3");
mp.prepare();
}catch(Exception e){e.printStackTrace();}
mp.start();
//------------------------------------------------------------------------------------------------------------
if (success) {
// File has been renamed
Toast.makeText(MainActivity.this, "Changed Extension .... ", Toast.LENGTH_SHORT).show();
}
EDIT: the question was first, how to play a MP3 file from a file from internal storage. My answer is related to that question.
You can use Context.getFilesDir() method to get the path to the internal storage.
Usage:
String path = getFilesDir() + "/" + name;
Note that the name can also contain directory names, if you put the mp3 file in a subdirectory.
Playing it:
mediaPlayer = new MediaPlayer();
mediaPlayer.setDataSource(path);
mediaPlayer.prepare();
mediaPlayer.start()

getAPKExpansionZipFile() returns null

Since my game has 100Mb I need to use expansion file. I put below code in the MainActivity in function onCreate()
ZipResourceFile expansionFile = null;
try {
expansionFile = APKExpansionSupport.getAPKExpansionZipFile(getApplicationContext(),2,0);
} catch (IOException e) {
e.printStackTrace();
}
I don't use patch expansion file, just main, so I guess putting 0 as a version is correct. When I log to check if expansionFile was successfully loaded I get null value.
if(expansionFile == null)
Gdx.app.log("EXPANSION_FILE", "NULL");
else
Gdx.app.log("EXPANSION_FILE", "NOT NULL");
I followed instructions on https://developer.android.com/google/play/expansion-files.html
and I put manually main.2.com.my.game.obb file in folder on my Nexus device:
Internal storage\Android\obb\com.my.game\
There are other obb files in Android\obb folder from other games, so this has to be a correct place. Any clues of why it doesn't mount the obb expansion file?
UPDATE
I implemented DownloaderActivity and it downloads expansion file without any problems. It was giving me "Not a zip archive" log message. I found a way to avoid it. I zipped OBB file and uploaded it to Developer Console. It automatically converted into OBB anyway but this time when I downloaded it on my Nexus it no longer gives me null value for ZipResourceFile and it doesn't give me "Not a zip archive" message anymore. But still I can't access files from it since I'm using AssetManager from Libgdx.
I found another way, which I'm testing now.
Solution to the problem where getAPKExpansionZipFile() returns null is to not use JOBB tool, but zip all the content and upload it. Google Play will convert it automatically to the OBB.
Complete solution to load images from expansion file:
I created a static variable in my own Game class which is an instance of ZipResourceFile . I made it static, because I wanted to load the expansion file in MainActivity class and use it in my FileHandle class to get images from it. If you find a different way it's up to you. This is how I did it.
public static ZipResourceFile expansionFile;
Then in your MainActivity class load expansion file. I did it in OnCreate() function.
try {
GameInfo.expansionFile = APKExpansionSupport.getAPKExpansionZipFile(getBaseContext(),22,0);
} catch (IOException e) {
e.printStackTrace();
}
Passed values to the function are these:
getAPKExpansionZipFile(Context ctx, int mainVersion, int patchVersion)
mainVersion needs to be exactly the same as declared in Manifest file :
android:versionCode="22"
Also your expansion file needs to have the same number in its name:
main.mainVersion.com.name.title
Create your own FileHandle class. This is where it looks for your specific file for example "image.png" in the expansion file.
public class CustomFileHandle extends FileHandle
{
public CustomFileHandle (String fileName) {
super(fileName);
}
#Override
public InputStream read()
{
InputStream input = null;
try {
input = GameInfo.expansionFile.getInputStream(file.getPath().replace('\\', '/'));
} catch (IOException e) {
e.printStackTrace();
}
return input;
}
}
Create your own FileHandleResolver class. This is where you use your custom FileHandle.
public class CustomFileHandleResolver implements FileHandleResolver
{
#Override
public FileHandle resolve(String fileName) {
return new CustomFileHandle(fileName);
}
}
Create instance of AssetManager and pass your FileHandleResolver to constructor.
assetManager = new AssetManager(new CustomFileHandleResolver());
If I did not omit any step then this is what you need to do to load your files from expansion file. As I mentioned in the begining I found the problem with using JOBB Tool to pack the files into OBB file. It makes getAPKExpansionZipFile() to return null. So I just zipped all the files instead. Look here for more detailed explanation : https://developer.android.com/google/play/expansion-files.html
For me it was the expansion file size in bytes. I rezipped and never changed the file size in code. Hence I was getting null value. I was off by only few bytes and that just took my entire day at workplace. Didn't realize it was that important :(
private static final XAPKFile[] xAPKS = {
new XAPKFile(true, Constants.MAIN_OBB_VERSION, Constants.EXPANSION_FILE_SIZE) // right here expansion file size must match exactly.
};
//in Constants class
public static final int EXPANSION_FILE_SIZE = 285516838; //expansion file size in bytes

Can not play video from my internal application directory

It looks like I can not play videos stored in my internal application directory.
I have videos stored in /data/data/my.package.org/files/
And I'm trying to play a file from there using
String fpath = "/data/data/my.package.org/files/video.mpg"
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(fpath), "video/*");
But both Android default video player and some external videoplayer (MX player) say 'this video can not be played".
Whereas when I'm saving videos to SD card they are played fine.
Why is that?
Put your video in assets folder and use this code to play video with MediaPlayer
InputStream is = getResources().getAssets().open("video.mpg");
OR
Put your video in assets folder and...
String fpath = "/data/data/my.package.org/assets/video.mpg"
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(fpath), "video/*");
put your video in the res\raw folder. Then copy it out to the external directories where apps like video player can read them. Only your app can read /data/data/blah....
if its in res\raw, then
typeName = sourceSink.Types.video.toString();
for (sourceSink.VideoFiles video: sourceSink.VideoFiles.values() ){
resourceName = video.toString();
fileName = resourceName + ".mp4";
resource = getResources().getIdentifier(resourceName, "raw", "com.invodo.allshareplay");
createExternalStoragePublicFile(typeName,fileName,resource);
}
and then you can use this to copy it:
void createExternalStoragePublicFile(String fType, String fname, int res ) {
// Create a path where we will place our picture in the user's
// public pictures directory. Note that you should be careful about
// what you place here, since the user often manages these files. For
// pictures and other media owned by the application, consider
// Context.getExternalMediaDir().
File path = null;
if (((fType.equals(sourceSink.Types.photo.toString())) || (fType.equals(sourceSink.Types.file.toString())) ) ){
path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
}
if (fType.equals(sourceSink.Types.music.toString())) {
path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_MUSIC);
}
if (fType.equals(sourceSink.Types.video.toString())) {
path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_MOVIES);
}
File file = new File(path, "/" + fname);
try {
// Make sure the Pictures directory exists.
path.mkdirs();
// Very simple code to copy a picture from the application's
// resource into the external file. Note that this code does
// no error checking, and assumes the picture is small (does not
// try to copy it in chunks). Note that if external storage is
// not currently mounted this will silently fail.
InputStream is = getResources().openRawResource(res);
OutputStream os = new FileOutputStream(file);
byte[] data = new byte[is.available()];
is.read(data);
os.write(data);
is.close();
os.close();
scanMedia(file);
} catch (IOException e) {
// Unable to create file, likely because external storage is
// not currently mounted.
Log.w("ExternalStorage", "Error writing " + file, e);
}
}
then it's easy - just do the second half of the answer I provided and write them out. /data/data/ folder is never going to be viewed by anything other than your app.

Play media from from zip file without unzipping

I know there are already a few questions like this on SO, but they relate to extracting the file before playing it.
In the Android docs here it explains that you can play files directly from a .zip file without extracting it.
Tip: If you're packaging media files into a ZIP, you can use media
playback calls on the files with offset and length controls (such as
MediaPlayer.setDataSource() and SoundPool.load()) without the need to
unpack your ZIP. In order for this to work, you must not perform
additional compression on the media files when creating the ZIP
packages. For example, when using the zip tool, you should use the -n
option to specify the file suffixes that should not be compressed:
zip -n .mp4;.ogg main_expansion media_files
I've made an (uncompressed) zip package, but I cannot figure out how to get from a ZipEntry to a FileDescriptor, and they don't explain any further. How do I get a FileDescriptor without unpacking the zip file?
You can use The APK Expansion Zip Library to do that even if you do not use APK Expansions in your app.
Follow this documentation to get the library: Using the APK Expansion Zip Library
Zip your sound files without compression using your favorite zip tool.
Use this code to load the music:
ZipResourceFile expansionFile = new ZipResourceFile("myZipFile.zip");
AssetFileDescriptor assetFileDescriptor = expansionFile.getAssetFileDescriptor("myMusic.mp3");
try {
mediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor());
mediaPlayer.prepare();
mediaPlayer.start();
}
catch (IOException e) {
// Handle exception
}
There aren't many recent solutions for this issue, so I was stuck on this, too – until I created a new instance of MediaPlayer in the function where I was trying to read the zip file. Suddenly playback started without problems. Now, instead, I'm passing my (global) MediaPlayer to the function like this: (Kotlin)
private fun preparePlayer(mp: MediaPlayer, position: Int) {
// Path of shared storage
val root: File = Environment.getExternalStorageDirectory()
Log.i("ROOT", root.toString())
// path of the zip file
val zipFilePath = File(root.absolutePath+"/Android/obb/MY_PACKAGE_NAME/MY_ZIP_FILE.zip")
// Is zip file recognized?
val zipFileExists = zipFilePath.exists()
Log.i("Does zip file exist?", zipFileExists.toString())
// Define the zip file as ZipResourceFile
val expansionFile = ZipResourceFile(zipFilePath.absolutePath)
// Your media in the zip file
val afd = expansionFile.getAssetFileDescriptor("track_01.mp3")
// val mp = MediaPlayer() // not necessary if you pass it as a function parameter
mp.setDataSource(afd.fileDescriptor, afd.startOffset, afd.length)
mp.prepare()
mp.start() // Music should start playing automatically
Maybe this can help someone else. Good luck!
try {
ZipFile zf= new ZipFile(filename);
ZipEntry ze = zip.getEntry(fileName);
if (ze!= null) {
InputStream in = zf.getInputStream(ze);
File f = File.createTempFile("_AUDIO_", ".wav");
FileOutputStream out = new FileOutputStream(f);
IOUtils.copy(in, out);
// play f
}
} catch (IOException e) {
}
possible duplicate question
If you want to use a media file from a zip without unzipping you have to add also start offset and length to setDataSource.
ZipResourceFile expansionFile = new ZipResourceFile("myZipFile.zip");
AssetFileDescriptor assetFileDescriptor = expansionFile.getAssetFileDescriptor("myMusic.mp3");
try {
mediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor(),
assetFileDescriptor.getStartOffset(),
assetFileDescriptor.getLength());
mediaPlayer.prepare();
mediaPlayer.start();
}
catch (IOException e) {
// Handle exception
}
You can create a custom MediaDataSource like this:
public class ZipMediaDataSource extends MediaDataSource {
private InputStream inputStream;
public ZipMediaDataSource(ZipFile file, ZipEntry zipEntry) throws IOException {
inputStream = file.getInputStream(zipEntry);
}
#Override
public int readAt(long position, byte[] buffer, int offset, int size) throws IOException {
return inputStream.read(buffer, offset, size);
}
#Override
public long getSize() throws IOException {
return inputStream.available();
}
#Override
public void close() throws IOException {
if (inputStream != null) {
inputStream.close();
inputStream = null;
}
}
}
usage is:
ZipMediaDataSource zipMediaDataSource = new ZipMediaDataSource(zipFile, zipEntry);
mediaPlayer.setDataSource(zipMediaDataSource);

Reading mp3 from expansion file

Reading mp3 file from expansion file
I have create and expansion file with name
"main.1.com.example.app.obb"
which contains and audio file name "about_eng.mp3"
Now the issue i have written the following code to read and play the mp3 file
private final static String EXP_PATH = "/Android/obb/";
static String[] getAPKExpansionFiles(Context ctx, int mainVersion, int patchVersion) {
String packageName = ctx.getPackageName();
Vector<String> ret = new Vector<String>();
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
// Build the full path to the app's expansion files
File root = Environment.getExternalStorageDirectory();
File expPath = new File(root.toString() + EXP_PATH + packageName);
// Check that expansion file path exists
if (expPath.exists()) {
if ( mainVersion > 0 ) {
String strMainPath = expPath + File.separator + "main." +
mainVersion + "." + packageName + ".obb";
File main = new File(strMainPath);
if ( main.isFile() ) {
ret.add(strMainPath);
}
}
if ( patchVersion > 0 ) {
String strPatchPath = expPath + File.separator + "patch." +
mainVersion + "." + packageName + ".obb";
File main = new File(strPatchPath);
if ( main.isFile() ) {
ret.add(strPatchPath);
}
}
}
}
String[] retArray = new String[ret.size()];
ret.toArray(retArray);
return retArray;
}
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
// Get a ZipResourceFile representing a merger of both the main and patch files
try {
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(this,1,1);
if(expansionFile!=null){
AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("about_eng.mp3");
//or
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setDataSource( fd.getFileDescriptor(),
fd.getStartOffset(),fd.getLength());
mediaPlayer.prepare();
mediaPlayer.start();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Get an input stream for a known file inside the expansion file ZIPs
}
But it is always throwing exception at this line
mediaPlayer.setDataSource( fd.getFileDescriptor(),
fd.getStartOffset(),fd.getLength());
mediaPlayer.prepare();
because the variable fd is null.
Can any body help me to solve this
i have googled and found that we shold have to make .zip with 0% (No compression) that is mention in http://developer.android.com/google/play/expansion-files.html
Tip: If you're packaging media files into a ZIP, you can use media playback calls on the files with offset and length controls (such as MediaPlayer.setDataSource() and SoundPool.load()) without the need to unpack your ZIP. In order for this to work, you must not perform additional compression on the media files when creating the ZIP packages. For example, when using the zip tool, you should use the -n option to specify the file suffixes that should not be compressed:
zip -n .mp4;.ogg main_expansion media_files
so How to make 0% compression zip using winrar?
here see the compression method
so we should have to upload this zip in play store.
so you not need to use ZipHelper.java that is mentioned in other SO answer
just simply use
ZipResourceFile expansionFile=null;
try {
expansionFile = APKExpansionSupport.getAPKExpansionZipFile(getApplicationContext(),3,0);
AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("test.mp3");
MediaPlayer mPlayer = new MediaPlayer();
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mPlayer.setDataSource(fd.getFileDescriptor(),fd.getStartOffset(),fd.getLength());
mPlayer.prepare();
mPlayer.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Try to use expansionFile.getAssetFileDescriptor("main_expansion/about_eng.mp3").
If it doesn't work, call this:
ZipResourceFile.ZipEntryRO [] entries = expansionFile.getAllEntries();
and look at the file names:
entries[0].mFileName;.
That could be a hint how the path should look like.
I know that the question is old, but maybe it helps someone.
To read mp3, with mediaplayer, you can do it 3 ways
for example. my application package name is
com.bluewindsolution.android.sampleapp
then my expansion file should be
main.1.com.bluewindsolution.android.sampleapp.obb
in detail, you can followed in here
[main|patch].< expansion-version >.< package-name >.obb
From expansion you can get it via 3 ways:
via AssetFileDescriptor
// this one work with image file, media file
// Get a ZipResourceFile representing a specific expansion file
// mainContext, version no. of your main expansion, version no of your patch
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(this, 1, 0);
AssetFileDescriptor afd_img1 = expansionFile.getAssetFileDescriptor("your_path/your_file.jpg");
AssetFileDescriptor afd_mpbg = expansionFile.getAssetFileDescriptor("your_path/your_file.mp3");
// to set image
ImageView imageView1 = (ImageView)findViewById(R.id.iv1);
imageView1.setImageBitmap(BitmapFactory.decodeFileDescriptor(afd_iv1.getFileDescriptor()));
// to set sound
try {
mpbg.setDataSource(afd_mpbg.getFileDescriptor(), afd_mpbg.getStartOffset(), afd_mpbg.getDeclaredLength());
mpbg.prepareAsync();
mpbg.start();
} catch (IllegalStateException e) {
Log.w("Error=====", "Failed to prepare media player", e);
}
via InputStream
// this one work with image file, media file
// Get a ZipResourceFile representing a specific expansion file
ZipResourceFile expansionFile = new ZipResourceFile(filePathToMyZip);
// Get an input stream for a known file inside the expansion file ZIPs
InputStream fileStream = expansionFile.getInputStream(pathToFileInsideZip);
via Uri
//this one can use in almost thing such as jpg, mp3, mp4, pdf, etc.
//you need to create new class to override APEZProvider
public class ZipFileContentProvider extends APEZProvider {
#Override
public String getAuthority() {
return "com.bluewindsolution.android.sampleapp";
}
}
//you need to add <provider> in AndroidManifest.xml
<provider
android:name="com.bluewindsolution.android.sampleapp.ZipFileContentProvider"
android:authorities="com.bluewindsolution.android.sampleapp"
android:exported="false"
android:multiprocess="true"
>
<meta-data android:name="mainVersion"
android:value="1"></meta-data>
</provider>
//after that you can use it any time by this code:
String filename2 = "image/i_commu_a_1_1_1_1.jpg"; // suppose you store put your file in directory in .obb
String uriString2 = "content://com.bluewindsolution.android.sampleapp" + File.separator + filename2;
Uri uri2 = Uri.parse(uriString2);
imageView2.setImageURI(uri2);
// Filename inside my expansion file
String filename = "video/v_do_1_1_1.mp4"; // suppose you store put your file in directory in .obb
String uriString = "content://com.bw.sample_extension_download_main" + File.separator + filename;
Uri uri = Uri.parse(uriString);
v1 = (VideoView)findViewById(R.id.videoView1);
v1.setVideoURI(uri);
v1.start();

Categories

Resources