How do open a remote Video file URL from a button click to play in the internal MediaPlayer without having to open a browser window?
The video plays fine, but it always opens a browser window 1st which is annoying.
This is what i am using already, but is it possible to launch the mediaplayer without the app opening a browser window first.
Hope someone can help
Thanks Lucy
final Button button = (Button) findViewById(R.id.play);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
// Perform action on click
Uri uri = Uri.parse("http://domain.com/videofile.mp4");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
}
Try this:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(videoPath), "video/mp4");
startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With