Skip to content

VPVideoPlayer

DV Infosys edited this page Jun 24, 2019 · 1 revision

Add VPVideoPlayer in your layout

<com.dvinfosys.widgets.VideoPlayer.VPVideoPlayerStandard
            android:layout_width="match_parent"
            android:id="@+id/vp_videoplayer"
            android:layout_height="250dp"/>

Set the video uri, video thumb url and video title

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        VPVideoPlayerStandard videoPlayerStandard = findViewById(R.id.vp_videoplayer);
        videoPlayerStandard.setUp("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4",VPVideoPlayerStandard.SCREEN_LAYOUT_NORMAL,"Elephant Dream");
        videoPlayerStandard.thumbImageView.setImageURI(Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/ElephantsDream.jpg"));
    }

    @Override
    public void onBackPressed() {
        if (VPVideoPlayer.backPress()){
            return;
        }
        super.onBackPressed();
    }
    @Override
    protected void onPause() {
        super.onPause();
        VPVideoPlayer.releaseAllVideos();
    }
Clone this wiki locally