【发布时间】:2015-03-22 00:29:19
【问题描述】:
实际上,我为 iphone 和 android 设备制作了一个应用程序.. 并且该视频功能可用,因此 iphone 设备上传的视频,视频 (mp4) 无法在 android 设备上播放,所以请任何人帮助我
pDialog = new ProgressDialog(this);
// Set progressbar message
pDialog.setMessage("Buffering...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
// Show progressbar
pDialog.show();
try {
// Start the MediaController
MediaController mediacontroller = new MediaController(
PlayVideoViewFromURLActivity.this);
mediacontroller.setAnchorView(mVideoView);
// Get the URL from String VideoURL
Uri videoUri = Uri.parse(vidUrl); // vidUrl is url of video which on server
mVideoView.setMediaController(mediacontroller);
mVideoView.setVideoURI(videoUri);
} catch (Exception e) {
e.printStackTrace();
}
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new OnPreparedListener() {
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
pDialog.dismiss();
mVideoView.start();
}
});
mVideoView.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
if (pDialog.isShowing()) {
pDialog.dismiss();
}
finish();
}
});
完整的 Logcat 错误:
08-13 09:45:10.062: D/MediaPlayer(1929): Couldn't open file on client side, trying server side
08-13 09:45:11.770: E/MediaPlayer(1929): error (1, -2147483648)
08-13 09:45:11.790: E/MediaPlayer(1929): Error (1,-2147483648)
08-13 09:45:11.790: D/VideoView(1929): Error: 1,-2147483648
【问题讨论】:
-
使用的
vidUrl是什么? -
我在我的 logcat 中得到了这个:08-13 09:45:10.054:W/EGL_emulation(1929):eglSurfaceAttrib 未实现 08-13 09:45:10.058:W/EGL_emulation(1929): eglSurfaceAttrib 未实现 08-13 09:45:10.062: D/MediaPlayer(1929): 无法在客户端打开文件,尝试服务器端 08-13 09:45:11.770: E/MediaPlayer(1929): 错误 (1 , -2147483648) 08-13 09:45:11.790: E/MediaPlayer(1929): 错误 (1,-2147483648) 08-13 09:45:11.790: D/VideoView(1929): 错误: 1,-2147483648 08 -13 09:45:11.802: W/EGL_emulation(1929): eglSurfaceAttrib 未实现
-
@Vaishali stackoverflow.com/questions/17865836/… 请参考此链接
-
@pratik 您正在复制粘贴她问题本身的代码。她在那里实施了同样的做法。
标签: android