Im trying to download video file from server and save in a path, then play this video file by video play in an android application. Im using android studio. Downloading from server and saving in below path successfully was done.
"/data/data/" + getPackageName() + "/raw/" + "video1_3"
But when i address the videoview to this path to play the video, the app crash.
videoPlayer = findViewById(R.id.videoView);
videoPlayer.setVideoPath("/data/data/" + getPackageName() + "/raw/" + "video1_3");
videoPlayer.start();
I checked the file in this path and Im sure that the downloaded file is there. but I couldn't play file from this directory. Could you please help me thanks in advance
I could figure out my problem. It was very stupid and delicate point. The point is that I forgot to add the file format and I should include file format to the end of file name. Therefore, I changed this line:
to:
Then the code work well for me.