Include the following dependency in your build.gradle files.
// Project level build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
// App level build.gradle
dependencies {
implementation 'com.github.pankaj89:MasterExoPlayer:1.0'
}
<com.master.exoplayer.MasterExoPlayer
android:id="@+id/masterExoPlayer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
binding.frame.url = model.sources
val recyclerView: RecyclerView = ....
val masterExoPlayerHelper = MasterExoPlayerHelper(mContext = this, id = R.id.masterExoPlayer)
masterExoPlayerHelper.makeLifeCycleAware(this)
masterExoPlayerHelper.attachToRecyclerView(recyclerView)
1. id : Int
View id of ExoPlayerView used in item layout
2. autoPlay : Boolean
If you want to autoplay video once loaded
3. playStrategy : Float
Visible area from 0 to 1, Which matches to play video, default value = PlayStrategy.DEFAULT i.e 0.75 means 75% area visible to starts play
4. muteStrategy: Values from MuteStratagy.ALL or MuteStratagy.INDIVIDUAL
Defines whether mute/unmute affects all rows or individual
5. defaultMute:Boolean
If default video should be muted or not
6. loop:Int
Defines if you want to loop the video, default is unlimited, if set to 1 it will play only 1 time then stoop.
Exo Player by Google (link)
Simple Adapter for RecyclerView (link)
Coil Image Loading library for Kotlin (link)
Runtime Permission Helper (link)
Simple Adapter for RecyclerView (link)
LocationHelper (link)
Copyright 2017 Pankaj Sharma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.