I am trying to play video song in my app with video-view. But I get nothing except a black screen, and display error 'can't play video'.It seems there are no errors as such in the code except log cat errors which I have never heard of.
VideoView videoView =(VideoView)findViewById(R.id.video_view_ex);
MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri= Uri.parse(Environment.getExternalStorageDirectory().getPath()+"/Memory Card/Video/Na Na Na Na -DJ 9dip.mp4");
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();
I guess it was because "/Memory Card/Video/Na Na Na Na -DJ 9dip.mp4"
Is already the path and, as you add Environment.getExternalStorageDirectory().getPath()
It creates a non-valid Uri, because the error you mention is reffered to a inexistent resource. Try leaving it instead:Uri uri= Uri.parse("/Memory Card/Video/Na Na Na Na -DJ 9dip.mp4");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With