Reputation: 33
I have project which have html5 video needed to play in native Android Player similar how it does on iOS. Is there way to implement it?
I will be grateful for any adivice or solution.Thanks.
Upvotes: 0
Views: 1049
Reputation: 396
Yes if you bring some codecs for your file format (.Flv I think) because android does not have those codes.
For a mp4 file use something like this:
try {
setContentView(R.layout.videodisplay);
String link="http://s1133.photobucket.com/albums/m590/Anniebabycupcakez/?action=view& current=1376992942447_242.mp4";
VideoView videoView = (VideoView) findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(link);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
} catch (Exception e) {
// TODO: handle exception
Toast.makeText(this, "Error connecting", Toast.LENGTH_SHORT).show();
}
Upvotes: 1