Android-媒体播放器
我是安卓新手。我正在尝试播放 SD 卡上的视频。
这是我使用的示例代码:
public class videoa extends Activity {
/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
VideoView videoView = (VideoView)this.findViewById(R.id.videoView);
MediaController mc = new MediaController(this);
videoView.setMediaController(mc);
// (1) Web
//videoView.setVideoURI(Uri.parse(
//"http://www.bogotobogo.com/Video/sample.3gp"));
//"http://www.bogotobogo.com/Video/sample.mp4"));
//"http://www.bogotobogo.com/Video/sample.mov"));
/* (2) SD card */
//videoView.setVideoPath("/sdcard/sample.3gp");
videoView.setVideoPath("/sdcard/robot.avi");
//videoView.setVideoPath("/sdcard/sample.mov");
// videoView.setVideoURI(Uri.parse(
//"file:///sdcard/sample.mov"));
videoView.requestFocus();
videoView.start();
}
}
我已手动启动并将目标设置为 -sdcard C:/android-sdk-windows/tools/sdcard.img
。
当我启动模拟器时,它显示视频无法显示
。
请帮帮我。
I am new to android. I am trying to play a video from sdcard.
this is the sample code I have used:
public class videoa extends Activity {
/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
VideoView videoView = (VideoView)this.findViewById(R.id.videoView);
MediaController mc = new MediaController(this);
videoView.setMediaController(mc);
// (1) Web
//videoView.setVideoURI(Uri.parse(
//"http://www.bogotobogo.com/Video/sample.3gp"));
//"http://www.bogotobogo.com/Video/sample.mp4"));
//"http://www.bogotobogo.com/Video/sample.mov"));
/* (2) SD card */
//videoView.setVideoPath("/sdcard/sample.3gp");
videoView.setVideoPath("/sdcard/robot.avi");
//videoView.setVideoPath("/sdcard/sample.mov");
// videoView.setVideoURI(Uri.parse(
//"file:///sdcard/sample.mov"));
videoView.requestFocus();
videoView.start();
}
}
I have launched manually And set the target as -sdcard C:/android-sdk-windows/tools/sdcard.img
.
When i have launched the emulator it shows Video Cannot be Displayed
.
Please help me out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试交换 2 条线
You try interchanging the 2 lines