How to add video playback and resource to Android app

I have a problem with my idea in andriod app. I would like to play the video in it, but I do not want to download it from interenet. In another case, I want to have it on the device.

So, a person downloads it from the Android market and can play video without downloading it. I came up with some solutions for this, but none of them are good.

At first he added it to the application resources, but you cannot have a video.

Secondly, the creation of a folder during installation was added or improved (the more specific first onCreate method), and then copying the video from the application. Well, this is not such a bad option (you can, for example, download, at one time only video from the network using the background service), but I have no idea how to delete it when uninstalling, since your application does not know when it is not known.

Does anyone know or have any ideas for this?

+8
android video android-video-player
Dec 25 '11 at 12:28
source share
1 answer

You can put the video in the application resources - just put it in the res/raw folder. You can play like this:

 VideoView videoview = (VideoView) findViewById(R.id.videoview); Uri uri = Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.splash); videoview.setVideoURI(uri); videoview.start(); 

The main thing to consider here is the size of your video. Since video files can be quite large, the resulting apk file can also become unacceptably large. Personally, I rarely would like to download an application from a market that weighs 10 megabytes (there are exceptions, of course).

+14
Dec 25 '11 at 12:37
source share



All Articles