Skip to content Skip to sidebar Skip to footer

How To Display Video From Url In My Android App?

This is an example of a video I want to show in my app. http://www.dailymotion.com/embed/video/x1ade3x 1.In Manifest I use permission like this Copy

Solution 2:

are you sure you want to call it in onCreate? Activity is not yet visible. Try something like this:

 VideoView videoView;
        videoView.post(newRunnable() {
            @Overridepublicvoidrun() {
                MediaControllermc=newMediaController(this);
                mc.setAnchorView(vdo_ContentVideo);
                mc.setMediaPlayer(vdo_ContentVideo);
                vdo_ContentVideo.setMediaController(mc);
                vdo_ContentVideo.setVideoURI(uri);
                vdo_ContentVideo.start();
            }
        });

Solution 3:

Hi First you need to convert your video file as .MP4 or .3GP mobile resolution supported. after that follow below code

VideoView video_player_view;
    DisplayMetrics dm;
    MediaController media_Controller;
     String path1="http://www.dailymotion.com/embed/video/x1ade3x";
Uri uri=Uri.parse(path1);

video_player_view = (VideoView) findViewById(R.id.video);
        dm = newDisplayMetrics();
        this.getWindowManager().getDefaultDisplay().getMetrics(dm);
        int height = dm.heightPixels;
        int width = dm.widthPixels;
        video_player_view.setMinimumWidth(width);
        video_player_view.setMinimumHeight(height);
        video_player_view
                .setVideoPath(uri);   //here you put your url
        video_player_view.start();

Post a Comment for "How To Display Video From Url In My Android App?"