ZExoRecyclerPlayer is an Android library that allows developers to easily create RecyclerView with Exoplayer .

Overview

ZExoRecyclerPlayer

Description

ZExoRecyclerPlayer is an Android library that allows developers to easily create RecyclerView with Exoplayer .

Please feel free to use this.

Features

  • AutoPlay Video When scroll RecyclerView

Demo

Getting Started

Dependencies

  • Step 1. Add the JitPack repository to your build file:
allprojects {
	repositories {
	 ...
	 maven { url 'https://jitpack.io' }
		}
	}
  • Step 2. Add the dependency:
dependencies {

  implementation 'com.github.alzoubiMohammed:ZExoRecyclerPlayer:1.2.2'
	
	}

Usage

  • Step 1. Add singleton Exoplayer and singleton PlayerView like {StyledPlayerView,PlayerControlView....} recommend to use Hilt Like :
@Module()
AppModule {
   ....
   
  @Provides
    fun provideExoplayerInstance(
        @ApplicationContext context: Context,
    ): ExoPlayer {
        return ExoPlayer.Builder(context).build()
    }

    @Singleton
    @Provides
    fun providePlayerView(
        @ApplicationContext context: Context, exoPlayer: ExoPlayer
    ): StyledPlayerView {
        val playerView = StyledPlayerView(context)
        playerView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
        playerView.useController = false
        playerView.player = exoPlayer
        ...
        return playerView
    }
    }
  • Step 2. Setup the RecycleView on Fragment Like :
    class Fragment{
        @Inject
        lateinit var exoPlayer: ExoPlayer

        @Inject
        lateinit var playerView: StyledPlayerView
         ...
        override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
         ...
         recyclerView.setupWithExoplayer(
                exoPlayer,
                playerView,
                viewLifecycleOwner
            )
         
            }
      }
  • and on Activity Like :
       class Activity{
         @Inject
         lateinit var exoPlayer: ExoPlayer

         @Inject
         lateinit var playerView: StyledPlayerView
          ...
        override fun onCreate(savedInstanceState: Bundle?) {
          ...
         recyclerView.setupWithExoplayer(
                exoPlayer,
                playerView,
                this
            )
         
            }
      }

  • Step 3.ViewHolder XML needs to be like :
   <androidx.constraintlayout.widget.ConstraintLayout
        ...
             >
          <FrameLayout
             ... 
           android:id="@+id/videoContainer"
   
           />
             
          <androidx.appcompat.widget.AppCompatImageView
             ...
             android:id="@+id/videoThumbnail"
  
           />

         <ProgressBar
            ...
           android:id="@+id/videoProgress"
          />

   </androidx.constraintlayout.widget.ConstraintLayout>

  • Step 4. finally ViewHolder need to implement the VideoPlayerSetup :
  • and you can read more about MediaSource
  class VideoViewHolder(itemView:View) :
  RecyclerView.ViewHolder(itemView), VideoPlayerSetup {
     ...
     
    fun bind(videoItem:VideoItem){
     *important to help ZExoRecyclerPlayer to know are ViewHolder has a video
      itemView.tag = this
       ...
    }
    
   override fun videoContainer(): ViewGroup {
            return itemView.videoContainer
        }

        override fun videoProgress(): View {
            return itemView.videoProgress
        }

        override fun videoThumbnail(): ImageView {
            return itemView.videoThumbnail
        }

        override fun attachment(): VideoData {
            return VideoData(videoItem.mediaSource,videoItem.currentPosition?:0L)
        }
  
  
     }

License

This project is licensed under the [MIT License] License - see the LICENSE.md file for details

You might also like...
Noice is an android app that allows you to create your own set of background sounds by mixing clips from environmental sources.
Noice is an android app that allows you to create your own set of background sounds by mixing clips from environmental sources.

A native Android app to relax, improve focus and boost productivity with minimal background noise.

 :sound: [Android Library] Easily generate pure audio tone of any frequency in android
:sound: [Android Library] Easily generate pure audio tone of any frequency in android

Android library to easily generate audio tone in android. Generating pure tone of an specific frequency was never that easy. ZenTone does all the heav

This is a project designed to help controlling Android MediaPlayer class. It makes it easier to use MediaPlayer ListView and RecyclerView. Also it tracks the most visible item in scrolling list. When new item in the list become the most visible, this library gives an API to track it.
AudLibPlayer is a library that allows a client to play from a collection of public domain audiobooks hosted on a web service

AudLibPlayer is a library that allows a client to play from a collection of public domain audiobooks hosted on a web service

SocyMusic is an open-source Android music player written in Java with the aim of creating an easy-to-use app for exchanging and listening to top-quality music. Help us create it!

SocyMusic SocyMusic is an open-source Android music player written entirely in Java. It's objectives are to provide top-quality music to everyone for

A Java API to read, write and create MP4 files

Build status: Current central released version 1.x branch: Current central released version 2.x branch: Java MP4 Parser A Java API to read, write and

An easy to use Instagram Video Downloader library for android apps.

Instagram-Video-Downloader-Library An easy to use library for directly download videos from ig reels, igtv. Implementation Step 1. Add the JitPack rep

Library for Instagram Image/Video Downloader for Android

Insta Downloader Simple Instagram Image Video Downloader Library for Android Implementation Step 1. Add the JitPack repository to your build file Add

Audio Tagger library for Flutter (Android only)

audio_tagger A Flutter (Android only) plugin for editing and extracting information from your music, at the moment it only works on AAC and OGG (last

Releases(1.2.2)
Owner
mohammed alzoubi
mohammed alzoubi
This is a basic demo application for exoplayer library.

ExoPlayer Demo Application This is a basic demo application for exoplayer library. It can stream these types of file: MP3 MP4 DASH HLS You can minimiz

Soumik 1 Apr 8, 2022
Simple and lightweight, yet polished and powerful Android video player based on ExoPlayer

Just (Video) Player Android video player based on ExoPlayer It uses ExoPlayer's extension-ffmpeg with all its audio formats enabled (it can handle eve

Marcel Dopita 677 Dec 28, 2022
Android podcast app made with Jetpack Compose and ExoPlayer.

Podcast App Android podcast app made with Jetpack Compose and ExoPlayer. Podcast information provided by Listen Notes API. Features Jetpack Compose UI

Fabian 302 Jan 2, 2023
Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer.

Yet Another Video Player Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer. Who Is YAVP For? First o

null 62 Dec 29, 2022
The androidx.media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android

AndroidX Media AndroidX Media is a collection of libraries for implementing media use cases on Android, including local playback (via ExoPlayer) and m

Android Jetpack 310 Dec 29, 2022
Android SRT player powered by Exoplayer and srtdroid

SrtPlayer An Android SRT test player powered by ExoPayer. Most of this code comes from YoussefHenna reply in the SRT support ExoPayer issue. It demons

Thibault Beyou 4 Sep 20, 2022
Sandbox project for practice: Media Streaming with Exoplayer (via Android Development tutorial)

Media streaming with ExoPlayer The code in this repository accompanies the Media streaming with ExoPlayer codelab. If you are looking to get started w

Jeannille Hiciano 1 Nov 29, 2021
Compose-video-player - Video player for Android Compose powered by ExoPlayer

Compose Video Player Video player for Android Compose powered by ExoPlayer. Addi

Juan Pablo Herrera 22 Dec 13, 2022
ExoPlayer - an application level media player for Android

ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks.

Halil Özel 6 Oct 31, 2022
A Spotify Clone that plays music and has similar UI to actual Spotify Mobile App. Made with Exoplayer and love ❤️

Spotify Clone A Spotify Clone App that can play music, and has a good looking UI that is very similar to actual Spotify Mobile App on Play Store I use

Utku Oruç 4 Oct 12, 2022