Hi I used a library called rtoshiro/FullscreeVideoView for play a video. But when I used a link of URL , it's pretty good . But when I parse my res file path its seen an error.
E/MediaPlayer: Error (-38,0)
XML:
<com.github.rtoshiro.view.video.FullscreenVideoLayout
android:id="@+id/videoPlayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
JAVA:
FullscreenVideoLayout videoLayout==findViewById(R.id.videoPlayer);
videoLayout.setActivity(this);
try {
String path="android.resource://" + getPackageName() + "/" + R.raw.test;
videoLayout.setVideoURI(Uri.parse(path));
// videoLayout.setVideoURI(Uri.parse("http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4"));
// Here , when I used webside link , it's playing good but otherwise not wroking.
} catch (IOException e) {
e.printStackTrace();
}
videoLayout.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.setLooping(true);
}
});
Error:
or See this logcat: when I pressed on playbutton it's showing...
V/MediaPlayer-JNI: isPlaying: 0
D/FullscreenVideoView: start
V/MediaPlayer-JNI: start
V/MediaPlayer: start
E/MediaPlayer: start called in state 0
V/MediaPlayer: message received msg=100, ext1=-38, ext2=0
E/MediaPlayer: error (-38, 0)
V/MediaPlayer: callback application
V/MediaPlayer: back from callback
D/FullscreenVideoLayout: startCounter
E/MediaPlayer: Error (-38,0)
D/FullscreenVideoView: onError called - -38 - 0
D/FullscreenVideoLayout: stopCounter
D/FullscreenVideoLayout: onCompletion
D/FullscreenVideoLayout: stopCounter