0
VideoView v =(VideoView) findViewById(R.id.videoView1);
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
v.setVideoPath(baseDir+"/ss.mp4");
v.setMediaController(new MediaController(play.this));
v.start();
v.requestFocus();

我有一个 VideoView,这是我插入视频的代码,但它没有播放,“无法播放此视频”,模拟器说。我该如何解决这个问题?你有其他代码插入视频吗?

I need a code of inserting a video on android..

这是 Logcat:

01-12 20:35:07.451: D/dalvikvm(336): GC_EXTERNAL_ALLOC freed 51K, 53% free 2560K/5379K, external 410K/517K, paused 114ms
01-12 20:35:12.480: D/dalvikvm(336): GC_EXTERNAL_ALLOC freed 12K, 52% free 2587K/5379K, external 831K/1306K, paused 145ms
01-12 20:35:29.080: W/KeyCharacterMap(336): No keyboard for id 0
01-12 20:35:29.101: W/KeyCharacterMap(336): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-12 20:35:34.831: D/dalvikvm(336): GC_EXTERNAL_ALLOC freed 26K, 53% free 2581K/5379K, external 911K/1552K, paused 488ms
01-12 20:35:38.681: D/dalvikvm(336): GC_EXTERNAL_ALLOC freed 22K, 52% free 2601K/5379K, external 919K/1386K, paused 72ms
01-12 20:35:43.340: E/MediaPlayer(336): error (1, -2147483648)
01-12 20:35:43.840: D/dalvikvm(336): GC_EXTERNAL_ALLOC freed 25K, 51% free 2677K/5379K, external 957K/1432K, paused 63ms
01-12 20:35:44.560: E/MediaPlayer(336): Error (1,-2147483648)
01-12 20:35:44.560: D/VideoView(336): Error: 1,-2147483648
01-12 20:37:37.191: D/dalvikvm(374): GC_EXTERNAL_ALLOC freed 53K, 53% free 2560K/5379K, external 410K/517K, paused 81ms
01-12 20:45:07.301: D/dalvikvm(374): GC_EXTERNAL_ALLOC freed 15K, 52% free 2596K/5379K, external 839K/1306K, paused 141ms
01-12 20:45:08.501: E/MediaPlayer(374): error (1, -2147483648)
01-12 20:45:09.040: E/MediaPlayer(374): Error (1,-2147483648)
01-12 20:45:09.050: D/VideoView(374): Error: 1,-2147483648
01-12 20:45:50.560: W/KeyCharacterMap(374): No keyboard for id 0
01-12 20:45:50.560: W/KeyCharacterMap(374): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-12 20:56:15.991: E/MediaPlayer(374): error (1, -2147483648)
01-12 20:56:16.351: E/MediaPlayer(374): Error (1,-2147483648)
01-12 20:56:16.351: D/VideoView(374): Error: 1,-2147483648
01-12 21:29:38.470: D/dalvikvm(410): GC_EXTERNAL_ALLOC freed 54K, 53% free 2560K/5379K, external 410K/517K, paused 92ms
01-12 21:41:11.070: D/dalvikvm(410): GC_EXTERNAL_ALLOC freed 14K, 52% free 2590K/5379K, external 831K/1306K, paused 111ms
01-12 21:44:57.890: W/KeyCharacterMap(410): No keyboard for id 0
01-12 21:44:57.900: W/KeyCharacterMap(410): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-12 21:45:01.270: D/dalvikvm(410): GC_EXTERNAL_ALLOC freed 16K, 52% free 2623K/5379K, external 1211K/1714K, paused 85ms
01-12 21:45:02.370: E/MediaPlayer(410): error (1, -2147483648)
01-12 21:45:02.860: E/MediaPlayer(410): Error (1,-2147483648)
01-12 21:45:02.860: D/VideoView(410): Error: 1,-2147483648
01-12 21:45:06.531: W/KeyCharacterMap(410): No keyboard for id 0
01-12 21:45:06.531: W/KeyCharacterMap(410): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-12 21:45:08.041: D/dalvikvm(410): GC_EXTERNAL_ALLOC freed 86K, 51% free 2674K/5379K, external 1054K/1432K, paused 74ms
01-12 22:28:36.910: W/KeyCharacterMap(410): No keyboard for id 0
01-12 22:28:36.910: W/KeyCharacterMap(410): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-12 22:28:39.100: D/dalvikvm(410): GC_EXTERNAL_ALLOC freed 74K, 51% free 2642K/5379K, external 1211K/1723K, paused 86ms
01-12 22:28:40.040: E/MediaPlayer(410): error (1, -2147483648)
01-12 22:28:40.450: E/MediaPlayer(410): Error (1,-2147483648)
01-12 22:28:40.450: D/VideoView(410): Error: 1,-2147483648
01-12 23:15:26.885: D/dalvikvm(477): GC_EXTERNAL_ALLOC freed 55K, 53% free 2560K/5379K, external 410K/517K, paused 105ms
01-12 23:56:35.670: D/dalvikvm(477): GC_EXTERNAL_ALLOC freed 15K, 52% free 2596K/5379K, external 839K/1306K, paused 83ms
01-12 23:56:37.713: E/MediaPlayer(477): error (1, -2147483648)
01-12 23:56:38.410: E/MediaPlayer(477): Error (1,-2147483648)
01-12 23:56:38.410: D/VideoView(477): Error: 1,-2147483648
4

1 回答 1

0

错误-2147483648意味着您的视频格式不正确。

请检查Android 支持的媒体格式

于 2013-01-12T16:02:52.693 回答