我正在使用录制视频和播放缓冲视频作为主要功能的应用程序。
当我在 Android 中录制视频时,保存在SERVER和另一个屏幕上我在VIDEO的服务器上获得了一个URL,该URL用于在MEDIA PLAYER的缓冲区中播放。
问题是,当从这个应用的iPhone版本录制和上传的视频无法在Android应用中播放时。缓冲后我得到了以下错误。
02-20 14:13:18.729: E/MediaPlayer(19417): error (1, -2147483648)
在Android设备中创建的视频,在同一台服务器上传,可轻松缓存并在Android设备中播放。
以下是从我的iPhone创建的视频的网址:
https://s3.amazonaws.com/WeddingApp/Weddingimage/1642_Video.MP4
我正在使用以下代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
setContentView(R.layout.video_view);
String videoUrl = this.getIntent().getStringExtra("VIDEO_URL");
initControls();
playVideo(videoUrl);
}
/**
* initControls
*/
private void initControls(){
try{
volumeSeekbar = (SeekBar)findViewById(R.id.sbarvolume);
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
volumeSeekbar.setMax(audioManager
.getStreamMaxVolume(AudioManager.STREAM_MUSIC));
volumeSeekbar.setProgress(audioManager
.getStreamVolume(AudioManager.STREAM_MUSIC));
volumeSeekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
@Override
public void onStopTrackingTouch(SeekBar arg0)
{
}
@Override
public void onStartTrackingTouch(SeekBar arg0)
{
}
@Override
public void onProgressChanged(SeekBar arg0, int progress, boolean arg2)
{
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
progress, 0);
}
});
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* playVideo
* @param videoUrl
*/
public void playVideo(String videoUrl){
videoView = (VideoView) findViewById(R.id.videoView);
getWindow().clearFlags(WindowManager
.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
mc = new MediaController(this);
videoView.setMediaController(mc);
videoView.requestFocus();
videoView.setVideoURI(Uri.parse(videoUrl));
mc.show();
videoView.start();
videoView.setOnTouchListener(this);
videoView.setOnClickListener(this);
videoView.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
VideoActivity.this.finish();
}
});
}
请建议我。
02-20 14:12:26.969: E/MediaPlayer(19417): Uri is https://s3.amazonaws.com/WeddingApp/Weddingimage/1644_Video.MP4
02-20 14:12:26.969: D/MediaPlayer(19417): http youtube = false, scheme = https
02-20 14:12:26.969: D/MediaPlayer(19417): Couldn't open file on client side, trying server side
02-20 14:12:27.279: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x53082000 size:2748416 offset:2134016 fd:191
02-20 14:12:27.409: D/memalloc(19417): /dev/pmem: Unmapping buffer base:0x52579000 size:2134016 offset:1519616
02-20 14:12:27.419: D/memalloc(19417): /dev/pmem: Unmapping buffer base:0x51fd1000 size:634880 offset:20480
02-20 14:12:33.919: E/MediaPlayer(19417): error (1, -2147483648)
02-20 14:12:33.939: E/MediaPlayer(19417): Error (1,-2147483648)
02-20 14:12:33.939: D/VideoView(19417): Error: 1,-2147483648
02-20 14:12:34.239: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x52579000 size:1806336 offset:1519616 fd:160
02-20 14:12:35.289: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x53321000 size:2093056 offset:1806336 fd:197
02-20 14:12:44.309: D/memalloc(19417): /dev/pmem: Unmapping buffer base:0x53321000 size:2093056 offset:1806336
02-20 14:12:44.309: D/memalloc(19417): /dev/pmem: Unmapping buffer base:0x52579000 size:1806336 offset:1519616
02-20 14:12:44.379: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x51fd1000 size:634880 offset:20480 fd:160
02-20 14:12:44.529: D/memalloc(19417): /dev/pmem: Unmapping buffer base:0x53082000 size:2748416 offset:2134016
02-20 14:12:45.529: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x52579000 size:2134016 offset:1519616 fd:164
02-20 14:13:14.709: E/MediaPlayer(19417): Uri is http://s3.amazonaws.com/WeddingApp/Weddingimage/1644_Video.MP4
02-20 14:13:14.709: D/MediaPlayer(19417): http youtube = false, scheme = http
02-20 14:13:14.709: D/MediaPlayer(19417): Couldn't open file on client side, trying server side
02-20 14:13:14.839: D/memalloc(19417): /dev/pmem: Unmapping buffer base:0x52579000 size:2134016 offset:1519616
02-20 14:13:14.839: D/memalloc(19417): /dev/pmem: Unmapping buffer base:0x51fd1000 size:634880 offset:20480
02-20 14:13:14.879: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x51fd1000 size:634880 offset:20480 fd:160
02-20 14:13:18.729: E/MediaPlayer(19417): error (1, -2147483648)
02-20 14:13:18.729: E/MediaPlayer(19417): Error (1,-2147483648)
02-20 14:13:18.729: D/VideoView(19417): Error: 1,-2147483648
02-20 14:13:19.019: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x52579000 size:921600 offset:634880 fd:164
02-20 14:13:20.069: D/memalloc(19417): /dev/pmem: Mapped buffer base:0x53093000 size:1806336 offset:1519616 fd:197