0

我正在开发一个应用程序,它有一个 VideoView 和一个按钮来启动视频,视频在模拟器上可以正常启动,但在实际手机上却不能。电话说“抱歉,无法播放此视频。”

主.java:

    package com.example.friends;

    import android.media.MediaPlayer;
    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;  
    import android.widget.MediaController;
    import android.widget.VideoView;

    public class InfoBoard extends Activity implements OnClickListener{
VideoView vid;
MediaPlayer mp;
MediaPlayer mp1;
MediaPlayer mp2;
MediaPlayer mp3;
MediaPlayer mp4;

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_info_board);

    mp = MediaPlayer.create(this, R.raw.danw);

    Button Btn1 = (Button) findViewById(R.id.btn1);
    Btn1.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {

        mp.start();
    }
});

    mp1 = MediaPlayer.create(this, R.raw.jackc);

    Button Btn2 = (Button) findViewById(R.id.btn2);
    Btn2.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {

        mp1.start();
    }
});

    mp2 = MediaPlayer.create(this, R.raw.infojon);

    Button Btn3 = (Button) findViewById(R.id.btn3);
    Btn3.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {

        mp2.start();
    }
});

    mp3 = MediaPlayer.create(this, R.raw.cam);

    Button Btn4 = (Button) findViewById(R.id.btn4);
    Btn4.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {

        mp3.start();
    }
});

    vid = (VideoView) findViewById(R.id.vid1);
    vid.setVideoPath("/sdcard/vid1.mp4");
    vid.setMediaController(new MediaController(this));
    vid.requestFocus();



    Button Btn5 = (Button) findViewById(R.id.next1);
    Btn5.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {
        vid.start();


          }

        });

这一切都适用于模拟器,但不适用于我的手机。

日志猫:

    08-16 16:24:14.789: W/MediaPlayer(9385): info/warning (1, 44)
    08-16 16:24:14.824: W/MediaPlayer(9385): info/warning (1, 44)
    08-16 16:24:14.867: W/MediaPlayer(9385): info/warning (1, 44)
    08-16 16:24:14.898: W/MediaPlayer(9385): info/warning (1, 44)
    08-16 16:24:14.937: W/MediaPlayer(9385): info/warning (1, 44)
    08-16 16:24:14.945: I/MediaPlayer(9385): Info (1,44)
    08-16 16:24:14.945: I/MediaPlayer(9385): Info (1,44)
    08-16 16:24:14.945: I/MediaPlayer(9385): Info (1,44)
    08-16 16:24:14.945: I/MediaPlayer(9385): Info (1,44)
    08-16 16:24:14.945: I/MediaPlayer(9385): Info (1,44)
    08-16 16:24:15.062: W/MediaPlayer(9385): info/warning (1, 26)
    08-16 16:24:15.062: E/MediaPlayer(9385): error (-4, -4)
    08-16 16:24:15.128: I/MediaPlayer(9385): Info (1,26)
    08-16 16:24:15.128: E/MediaPlayer(9385): Error (-4,-4)
    08-16 16:24:15.128: D/VideoView(9385): Error: -4,-4
4

0 回答 0