Reputation: 31
I am trying to reproduce a video in android this code doesn’t work for Android Lollipop help please I tried this:
String videopath = "android.resource://com.example.video/"+R.raw.a;
Uri vidUri = Uri.parse(videopath);
videoView = findViewById(R.id.videoView);
videoView.setVideoURI(vidUri);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
videoView.start();
}
});
This is the error:
03-02 23:09:50.923 8141-8158/com.example.video E/MediaPlayer: error (1, -38)
03-02 23:09:50.923 8141-8157/com.example.video E/MediaPlayer: error (1, -38)
03-02 23:09:50.936 8141-8141/com.example.video E/MediaPlayer: start called in state 0
03-02 23:09:50.936 8141-8141/com.example.video E/MediaPlayer: error (-38, 0)
03-02 23:09:50.967 8141-8141/com.example.video E/MediaPlayer: Error (1,-38)
03-02 23:09:50.967 8141-8141/com.example.video D/VideoView: Error: 1,-38
03-02 23:09:50.977 8141-8141/com.example.video E/MediaPlayer: Error (1,-38)
03-02 23:09:50.978 8141-8141/com.example.video D/VideoView: Error: 1,-38
03-02 23:09:50.987 8141-8141/com.example.video E/MediaPlayer: Error (-38,0)
03-02 23:09:50.987 8141-8141/com.example.video D/VideoView: Error: -38,0
Upvotes: 1
Views: 239
Reputation: 31
I solved it the problem was the video format with lollipop and old versions i to re-encode the video with the baseline H.264 profile using a tool like Handbrake.
Upvotes: 2