public class MainActivity extends AppCompatActivity {
Button clk;
VideoView videov;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
clk=(Button) findViewById(R.id.video);
videov=(VideoView)findViewById(R.id.videoView);
}
public void videoplay(View v){
String videopath = "android.resource://"+getPackageName()+"+R.raw.movie";
Uri uri =Uri.parse(videopath);
videov.setVideoURI(uri);
videov.requestFocus();
videov.start();
}
}
Can't play this video error...!! see the picture Screen Shot What to do ? After pressing play button it says cant play this video..!! Need solution of this problem.
Hi day before yesterday i had same problem and tried almost everything but didn't get any success. After that i used this library and it work fine. Just follow few steps:
Step1. Add it to your gradle
Step2. Add it as your video play in xml layout.
Step 3. Check from here how to use this library in your class,
One more bonus thing from my side. You can do video cache also by using this library. Yesterday i found this also.One time play from internet.After it play without internet also.
Updated answer:
Above example i have provided for playing online videos from url but this question have problem related to video path problem.
Just Changed this path:
To this,
Thanks hope this will help you.