Video not working properly in the below mentioned code. What could be the problem for this?
MediaController mediaController = new MediaController(getBaseCont
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
mVideoView = (VideoView) findViewById(R.id.surface_view);
}
private void playVideo() {
try {
final String path = "http://www.youtube.com/v/wwI2w2YHkCQ?fs=1"
System.out.println("path "+path);
Log.v(TAG, "path: " + path);
if (path == null || path.length() == 0) {
Toast.makeText(VideoViewDemo.this, "File URL/path is empty",
Toast.LENGTH_LONG).show();
}
else {
System.out.println("else ");
// If the path has not changed, just start the media player
if (path.equals(current) && mVideoView != null) {
System.out.println("mVideoView.start() ");
mVideoView.start();
mVideoView.requestFocus();
return;
}
current = path;
//mVideoView.setVideoPath(getDataSource(path));
mVideoView.setVideoURI(Uri.parse(path));
mVideoView.start();
mVideoView.requestFocus();
}
}
catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
if (mVideoView != null) {
mVideoView.stopPlayback();
}
}
}