Search code examples
androidvideocordovaplaybackphonegap-plugins

Playing a mp4 video with from the res/raw folder via phonegap videoplayer-plugin


im trying to play a video from the raw folder with phonegap. I modified the original plugin a little bit. this is the code:

       Uri uri = Uri.parse( "android.resource://" + getPackageName() + "/raw/"+R.raw.test);
    // Uri uri = Uri.parse("http://www.test.sociato.de/test.mp4");

    Intent intent = null;
        // Display video player
        intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(uri, "video/*");

    this.ctx.startActivity(intent);

The video is in the raw folder and is named test.mp4. The code doesnt work.

I think that the url to the video isnt correct? I would be very pleased of any help.


Solution

  • I think you can't play video from application's private package to default video player,Because your default video player can't recognize this path.

    To make it play you have to copy this video file in sdcard and then give URI of that file, in this case it works fine.