Reputation: 1621
I need to play a 3gp file which is stored in the assets folder.
Also i require to play the video in native android player not in the video view please help me i struck at this
thanks in advance
jibysthomas
Upvotes: 0
Views: 439
Reputation: 22168
If you were to put your file in the res/raw folder rather than the assets folder (any reason why you can't do this?), you could use the MediaPlayer
class. This sample assumes you have your file in *res/ra*w and the file is thus assigned a resource ID and can be accessed via R.raw.my3gpFile
for the resId
parameter.
private void playResource(Context context, int resId) {
MediaPlayer player = MediaPlayer.create(context, resId);
player.start();
player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.release();
}
});
}
Upvotes: 1