I have a VideoView
that should start when the user click on "play button"
but it doesn't work.
After some debug and some test, I see that if I start the video at the begin of the OnCreate()
, it works perfect (it sets the URI).
But when I try to use the function setVideoUri
inside of a Button onClickListener
, it just doesn't work (it is like I don't call it).
There is no errors, or crash, just nothing happens.
Any ideas?
ImageView play2;
VideoView vView;
String video_url="URL OF THE VIDEO";
play2.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
play.setVisibility(-1);
publicidad.setVisibility(-1);
principal.setVisibility(-1);
vView.setVisibility(1);
play2.setVisibility(-1);
vView.requestFocus();
String a = urls_fotos[posicion][0];
vView.setVideoURI(Uri.parse(video_url));
vView.setMediaController(new MediaController(ctx));
vView.start();
TextView ere= (TextView) findViewById(R.id.titulo);
ere.setVisibility(-1);
ere.setVisibility(1);
}
});