Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android E/ExtMediaPlayer-JNI: env->IsInstanceOf fails E/MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0

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();
like image 426
Navadip Patel Avatar asked Nov 08 '22 17:11

Navadip Patel


1 Answers

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");

like image 184
Dani Torres Avatar answered Dec 14 '22 07:12

Dani Torres