我的本地服务器中有一个视频文件。我正在用视频文件的 URL 提供我的 android 代码。我在 Htdocs 文件夹的视频文件夹中有视频文件。我在stackoverflow上查找了相同的问题,但找不到解决方案。请帮忙。这是代码..
public class WatchActivity extends Activity {
String SrcPath = "http://localhost/video/Coldplay - In My Place.mp4";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview);
myVideoView.setVideoURI(Uri.parse(SrcPath));
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.start();
}
}
这是这个的logcat
10-06 12:02:11.473: D/MediaPlayer(332): Couldn't open file on client side, trying server side
10-06 12:02:11.523: E/MediaPlayer(332): error (1, -111)
10-06 12:02:11.723: E/MediaPlayer(332): Error (1,-111)
10-06 12:02:11.723: D/VideoView(332): Error: 1,-111
10-06 12:02:12.083: D/dalvikvm(332): GC_EXTERNAL_ALLOC freed 65K, 52% free 2609K/5379K, external 1813K/2137K, paused 50ms