简体   繁体   English

无法在 Android Lollipop 中播放视频

[英]Can't play video in Android Lollipop

I am trying to reproduce a video in android this code doesn't work for Android Lollipop help please I tried this:我正在尝试在 android 中重现视频此代码不适用于 Android Lollipop 帮助,请尝试以下操作:

        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

我解决了它的问题是棒棒糖和旧版本的视频格式,我使用Handbrake之类的工具使用基线H.264配置文件重新编码视频。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM