1

Can anyone suggest me, Why this code is not working.....

public class VideoActivity extends Activity {

/** Called when the activity is first created. */
String Link="http://www.veoh.com/watch/v18571861xWT9d7yF";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    VideoView videoView = (VideoView) findViewById(R.id.videoView1);
    MediaController mc = new MediaController(this);
    mc.setAnchorView(videoView);
    mc.setMediaPlayer(videoView);
    Uri video = Uri.parse(Link);
    videoView.setMediaController(mc);
    videoView.setVideoURI(video);
    videoView.start();
    }
}
sll
  • 61,540
  • 22
  • 104
  • 156
Ranjit Mishra
  • 440
  • 4
  • 8

1 Answers1

0

Try using the following code....

It worked for me....Very similar to your code except mc.setMediaPlayer(videoView); Also the I think it has to do with the dimensions of 3gp video that you are trying to play. The Vidoe URL in my code is working fine with videoview. ` package ramit.android.videoexample;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.*;
public class video extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    VideoView v1= (VideoView)findViewById(R.id.videoView1);
    MediaController mc = new MediaController(this);


    mc.setAnchorView(v1);
    Uri video = Uri.parse("http://www.jsharkey.org/downloads/dailytest.3gp");
    v1.setMediaController(mc);
    v1.setVideoURI(video);
    v1.start();
}
}`
ramit girdhar
  • 2,272
  • 1
  • 25
  • 26