MediaPlayer从服务器播放mp4

时间:2012-07-10 18:47:43

标签: android

我在服务器上有一些mp4文件,我需要使用该应用程序。 这是我的代码:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.watch);  
    VideoView videoView = (VideoView) findViewById(R.id.videoView1);
    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    Uri video = Uri.parse("http://php page that return the mp4");
    videoView.setMediaController(mediaController);
    videoView.setVideoURI(video);
    videoView.start();
}

我在真正的手机上尝试了代码2.3.5 LogCat:

07-10 19:33:26.409: D/MediaPlayer(1432): Couldn't open file on client side, trying server side
07-10 19:33:26.479: D/VideoView(1432): onMeasure()
07-10 19:33:26.479: I/VideoView(1432):     Setting size: 320x202
07-10 19:33:33.379: D/VideoView(1432): onMeasure()
07-10 19:33:33.379: I/VideoView(1432):     Setting size: 320x180
07-10 19:33:33.419: I/VideoView(1432): start()
07-10 19:33:33.469: E/MediaPlayer(1432): error (1, -2147483648)
07-10 19:33:33.479: E/MediaPlayer(1432): Error (1,-2147483648)
07-10 19:33:33.489: D/VideoView(1432): Error: 1,-2147483648
07-10 19:34:12.809: W/KeyCharacterMap(1432): No keyboard for id 0
07-10 19:34:12.809: W/KeyCharacterMap(1432): Using default keymap: /system/usr/keychars/qwerty.kcm.bin

0 个答案:

没有答案