我试图从SD卡播放视频,但我遇到了一个恼人的错误:
com.example.aidan.playvideo E/MediaPlayer﹕ error (1, -2147483648)
并且它不起作用,这是主要代码:
public class Video extends ActionBarActivity {
String SrcPath = "/sdcard/Video/sintel.mp4";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
final VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setVideoPath(SrcPath);
videoView.start();
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
一些日志:
11-14 18:39:00.497 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ constructor
11-14 18:39:00.497 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ setListener
11-14 18:39:00.607 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ setDataSource(/storage/sdcard0/Video/sintel.mp4)
11-14 18:39:00.707 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ setVideoSurfaceTexture
11-14 18:39:00.717 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ MediaPlayer::setAudioStreamType
11-14 18:39:00.717 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ setVideoSurfaceTexture
11-14 18:39:00.717 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ prepareAsync
11-14 18:39:00.737 10670-10681/com.example.aidan.playvideo V/MediaPlayer﹕ message received msg=100, ext1=1, ext2=-2147483648
11-14 18:39:00.737 10670-10681/com.example.aidan.playvideo E/MediaPlayer﹕ error (1, -2147483648)
11-14 18:39:00.737 10670-10681/com.example.aidan.playvideo V/MediaPlayer﹕ callback application
11-14 18:39:00.737 10670-10681/com.example.aidan.playvideo V/MediaPlayer﹕ back from callback
11-14 18:39:00.917 10670-10670/com.example.aidan.playvideo E/MediaPlayer﹕ Error (1,-2147483648)
11-14 18:39:00.917 10670-10670/com.example.aidan.playvideo D/VideoView﹕ Error: 1,-2147483648
11-14 18:39:04.807 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ reset
11-14 18:39:04.827 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ setListener
11-14 18:39:04.827 10670-10670/com.example.aidan.playvideo V/MediaPlayer﹕ disconnect
11-14 18:39:04.827 10670-10682/com.example.aidan.playvideo V/MediaPlayer﹕ destructor
11-14 18:39:04.837 10670-10682/com.example.aidan.playvideo V/MediaPlayer﹕ disconnect