Skip to content

PavanKumarPatruni/custom-video-player

Repository files navigation

Custom Video Player for Android

Introduction

Custom Video Player is a library with simple and clean controllers that can be embedded anywhere in Android Applications. It can play single or multiple videos from URLs. Added auto mute, auto play to manage video player. Customized controllers and methods.

Documentation

How to import

  1. Clone or download the code & unzip
  2. Go to File > Import Module and import the library as a module.

Add to layout

<com.pavanpathro.custom_video_player.CustomVideoPlayer
    android:id="@+id/customVideoPlayer"
    android:layout_width="match_parent"
    android:layout_height="300dp" />

Initialise Video Player

CustomVideoPlayer customVideoPlayer = findViewById(R.id.customVideoPlayer);

Single Video

customVideoPlayer.setMediaUrl("https://www.rmp-streaming.com/media/bbb-360p.mp4");

Auto Mute (Default - false)

customVideoPlayer.enableAutoMute(true);

Auto Play (Default - true)

customVideoPlayer.enableAutoPlay(false);

Set MinHeight

customVideoPlayer.setMinHeight(300);

Set MaxHeight

customVideoPlayer.setMaxHeight(500);

Manage Controllers (Default - false)

customVideoPlayer.hideControllers(true);

Example

customVideoPlayer.setMediaUrls(listOfVideos)
    .enableAutoMute(false)
    .enableAutoPlay(false)
    .hideControllers(false)
    .setOnPlaybackListener(this)
    .build();

Video Controllers

Play

customVideoPlayer.play();

Pause

customVideoPlayer.pause();

Stop

customVideoPlayer.stop();

Samples

Author

Pavan Kumar Patruni (Email - [email protected])