1

媒体播放器不适用于 android 2.3.6 但相同的代码适用于 4.x 版本。我正在使用以下代码播放视频

public class MainActivity extends Activity
{

 @Override
    public void onCreate(Bundle savedInstanceState)
    { 
        String mp4Path ="https://example.com/adplayer/XXX.mp4";
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.activity_main);

        VideoView videoView =(VideoView)findViewById(R.id.videoView);
        Uri video = Uri.parse(mp4Path);


        videoView.setVideoURI(video);
        videoView.setMediaController(new MediaController(this));       
        videoView.requestFocus();

        videoView.start();
     }
}

我收到以下错误,我这边有什么问题?

10-31 12:51:14.710: I/VideoView(25774): start()
10-31 12:51:14.742: D/VideoView(25774): onMeasure()
10-31 12:51:14.757: I/VideoView(25774):     Setting size: 240x282
10-31 12:51:14.914: I/MediaPlayer(25774): path is null
10-31 12:51:14.914: D/MediaPlayer(25774): Couldn't open file on client side, trying server side
10-31 12:51:14.976: E/MediaPlayer(25774): error (1, -2147483648)
10-31 12:51:15.171: E/MediaPlayer(25774): Error (1,-2147483648)
10-31 12:51:15.179: D/VideoView(25774): Error: 1,-2147483648
4

1 回答 1

1

我认为 mp4 格式不支持。请尝试一些 3gp 格式的视频。

参考支持的格式 - http://developer.android.com/guide/appendix/media-formats.html

于 2013-10-31T07:54:10.203 回答