# Drop-in Android Video -- Exoplayer2 with Picture in Picture

DevFeed: [Drop-in Android Video -- Exoplayer2 with Picture in Picture](<https://devfeed.tech/articles/drop-in-android-video-exoplayer2-with-picture-in-picture-26010.md>)

Original publisher: [Read original article](<https://medium.com/s23nyc-tech/drop-in-android-video-exoplayer2-with-picture-in-picture-e2d4f8c1eb30?source=rss-2ffcf6104135------2>)

Author: Stacy Devino

Published: 2018-09-13T15:58:58Z

Content type: tutorial

Language: en

Sources: [Stories by Stacy Devino on Medium](<https://devfeed.tech/sources/stories-by-stacy-devino-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [ExoPlayer](<https://devfeed.tech/topics/exoplayer.md>), [picture-in-picture](<https://devfeed.tech/topics/picture-in-picture.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Streaming](<https://devfeed.tech/topics/streaming.md>), [Code](<https://devfeed.tech/topics/code.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [code](<https://devfeed.tech/tags/code.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [exoplayer](<https://devfeed.tech/tags/exoplayer.md>), [exoplayer2](<https://devfeed.tech/tags/exoplayer2.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [nike](<https://devfeed.tech/tags/nike.md>), [picture-in-picture](<https://devfeed.tech/tags/picture-in-picture.md>), [streaming](<https://devfeed.tech/tags/streaming.md>), [ui](<https://devfeed.tech/tags/ui.md>), [video](<https://devfeed.tech/tags/video.md>)

## AI overview

This tutorial explains how to add Android video playback with ExoPlayer2, including URL-based playback, Gradle dependencies, UI setup, and Kotlin implementation. It also introduces Android picture-in-picture support and notes that device support can vary.

## Source excerpt

Beautiful, interactive video content done easy. Video has been shown to increase engagement in apps and with content. How else could gif servicing apps be worth tens of millions and Youtube influencers be selling billions of dollars of product? The problem is that video in Android can be difficult. You are given the assumption that the video types you will support are pretty basic : embedded MPEG video, URLs to MP4/AVI files, and HLS Streaming. A naive approach would be to use the embedded video player sent with Intents, but that takes the user out of your app. You think, 🤔 " I'll just use the Android VideoView class with AppCompat ." Then you realize that it is nearly impossible to make the experience consistent across users because of codec support and whatever the phone manufacturer may have customized in the video player. Finally you settle on Exoplayer2 because it is the package everyone, including Google, uses. Upon further inspection, you quickly realize that it requires a lot of code to make it work and the example application on the Github is confusing, far too extensive for what you are doing. Another route you could take is ExoMedia by Brian Wernick, but it trades extensibility, theming, and control for simplicity. Fortunately, you only need the Exoplayer2 libraries to have a fantastic video player experience within your app. SimpleExoplayer "2" the Rescue First you need to make an app which can receive a URL and play it using Exoplayer. For this, you will need SimpleExoplayer and the Playerview from the UI package. Playerview has easy to manipulate styling/theming elements as well as available media controls. SimpleExoPlayer gives you a preconfigured player to work with without having to handle deeper logic yourself. Start by adding the Gradle dependencies to your build.gradle : implementation 'com.google.android.exoplayer:exoplayer-core:2.X.X' implementation 'com.google.android.exoplayer:exoplayer-hls:2.X.X' implementation 'com.google.android.exoplayer: