An Android application that demonstrates a TikTok-style vertical video reel using Media3 ExoPlayer and ViewPager2.
- Vertical scrolling video feed using
ViewPager2. - Seamless video playback with
ExoPlayer. - Support for local video resources (MP4).
- Fullscreen video activity on item click.
- Automatic playback and looping.
MainActivity.kt: Sets up theViewPager2and handles the video data list.ReelAdapter.kt: Manages theExoPlayerinstances for each reel and handles view recycling.ReelViewHolder.kt: Holds thePlayerViewand UI elements for each reel item.ExoplayerActivity.kt: A dedicated activity for viewing a specific reel in detail.res/raw: Contains the video assets (video_1.mp4tovideo_5.mp4).
- Ensure you have the latest version of Android Studio installed.
- Clone the repository and open the project.
- Sync the project with Gradle files.
- Run the application on an Android device or emulator (API 24+).
- Resource Management: Moved video files from
res/drawabletores/rawto comply with Android resource standards and fixed naming conventions (starting with letters). - Memory Optimization: Implemented proper
ExoPlayerrelease logic in the adapter'sonViewRecycledto prevent memory leaks during scrolling. - Playback Issues: Added diagnostic logging to investigate decoding issues on some devices for specific video files.
androidx.media3:media3-exoplayerandroidx.media3:media3-uiandroidx.viewpager2:viewpager2androidx.constraintlayout:constraintlayout