Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Dg bump exoplayer 2.16 #2

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
}
}
Expand All @@ -17,6 +17,6 @@ allprojects {
}

ext {
exoPlayerVersion = "2.9.6"
exoPlayerVersion = "2.16.1"
supportLibVersion = "28.0.0"
}
19 changes: 10 additions & 9 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlinVersion = '1.3.10'
ext.kotlinVersion = '1.5.31'
repositories {
google()
jcenter()
Expand All @@ -18,28 +18,29 @@ dependencies {
implementation project(':library')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"

implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion"
implementation "com.android.support:support-media-compat:$rootProject.ext.supportLibVersion"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.media:media:1.4.3'
implementation "com.google.android.exoplayer:extension-okhttp:$rootProject.ext.exoPlayerVersion"
implementation "com.google.android.exoplayer:exoplayer-ui:$rootProject.ext.exoPlayerVersion"

// Image Loading
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

// Playlist support
implementation 'com.devbrackets.android:playlistcore:2.0.1'

// Memory Leak diagnostics
implementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
implementation 'com.squareup.leakcanary:leakcanary-android:2.7'
}

android {
compileSdkVersion 28
compileSdkVersion 31

defaultConfig {
applicationId "com.devbrackets.android.exomediademo"
minSdkVersion 16
targetSdkVersion 28
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0.0"
}
Expand Down
18 changes: 12 additions & 6 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
android:name=".App">
<activity
android:name=".ui.activity.StartupActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand All @@ -24,24 +25,29 @@
<activity
android:name=".ui.activity.VideoPlayerActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_video_player">
android:label="@string/title_activity_video_player"
android:exported="false">
</activity>
<activity
android:name=".ui.activity.FullScreenVideoPlayerActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_video_player">
android:label="@string/title_activity_video_player"
android:exported="false">
</activity>
<activity
android:name=".ui.activity.VideoSelectionActivity"
android:label="@string/title_activity_video_player">
android:label="@string/title_activity_video_player"
android:exported="false">
</activity>
<activity
android:name=".ui.activity.AudioSelectionActivity"
android:label="@string/title_activity_audio_player">
android:label="@string/title_activity_audio_player"
android:exported="false">
</activity>
<activity
android:name=".ui.activity.AudioPlayerActivity"
android:label="@string/title_activity_audio_player">
android:label="@string/title_activity_audio_player"
android:exported="false">
</activity>


Expand Down
28 changes: 20 additions & 8 deletions demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,53 @@ package com.devbrackets.android.exomediademo
import android.app.Application
import com.devbrackets.android.exomedia.ExoMedia
import com.devbrackets.android.exomediademo.manager.PlaylistManager
import com.google.android.exoplayer2.database.DatabaseProvider
import com.google.android.exoplayer2.database.ExoDatabaseProvider
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.DataSource
import com.google.android.exoplayer2.upstream.TransferListener
import com.google.android.exoplayer2.upstream.cache.CacheDataSource
import com.google.android.exoplayer2.upstream.cache.CacheDataSourceFactory
import com.google.android.exoplayer2.upstream.cache.CacheDataSource.Factory
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor
import com.google.android.exoplayer2.upstream.cache.SimpleCache
import com.squareup.leakcanary.LeakCanary
import okhttp3.OkHttpClient
import java.io.File

class App : Application() {
val playlistManager: PlaylistManager by lazy { PlaylistManager(this) }
private lateinit var databaseProvider: DatabaseProvider

override fun onCreate() {
super.onCreate()

LeakCanary.install(this)
configureExoMedia()
}

private fun configureExoMedia() {
databaseProvider = ExoDatabaseProvider(this)
// Registers the media sources to use the OkHttp client instead of the standard Apache one
// Note: the OkHttpDataSourceFactory can be found in the ExoPlayer extension library `extension-okhttp`
ExoMedia.setDataSourceFactoryProvider(object : ExoMedia.DataSourceFactoryProvider {
private var instance: CacheDataSourceFactory? = null
private var instance: CacheDataSource.Factory? = null

override fun provide(userAgent: String, listener: TransferListener?): DataSource.Factory {
override fun provide(
userAgent: String,
listener: TransferListener?
): DataSource.Factory {
if (instance == null) {
// Updates the network data source to use the OKHttp implementation
val upstreamFactory = OkHttpDataSourceFactory(OkHttpClient(), userAgent, listener)
val upstreamFactory =
OkHttpDataSourceFactory(OkHttpClient(), userAgent, listener)

// Adds a cache around the upstreamFactory
val cache = SimpleCache(File(cacheDir, "ExoMediaCache"), LeastRecentlyUsedCacheEvictor((50 * 1024 * 1024).toLong()))
instance = CacheDataSourceFactory(cache, upstreamFactory, CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)
val cache = SimpleCache(
File(cacheDir, "ExoMediaCache"),
LeastRecentlyUsedCacheEvictor((50 * 1024 * 1024).toLong()),
databaseProvider
)
instance = CacheDataSource.Factory().setCache(cache)
.setUpstreamDataSourceFactory(upstreamFactory)
.setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)
}

return instance!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ object Samples {

//Video items
videoSamples = ArrayList()
videoSamples.add(Sample("FLV - Big Buck Bunny by Blender", "http://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0"))
videoSamples.add(Sample("HLS - ArtBeats", "http://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8"))
videoSamples.add(Sample("FLV - Big Buck Bunny by Blender", "https://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0"))
videoSamples.add(Sample("HLS - ArtBeats", "https://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8"))
videoSamples.add(Sample("HLS - Sintel by Blender", "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8"))
videoSamples.add(Sample("MKV - Android Screens", "http://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv"))
videoSamples.add(Sample("MP4 (VP9) - Google Glass", "http://demos.webmproject.org/exoplayer/glass.mp4"))
videoSamples.add(Sample("MKV - Android Screens", "https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv"))
videoSamples.add(Sample("MP4 (VP9) - Google Glass", "https://demos.webmproject.org/exoplayer/glass.mp4"))
videoSamples.add(Sample("MPEG DASH - Sintel by Blender", "https://bitdash-a.akamaihd.net/content/sintel/sintel.mpd"))
videoSamples.add(Sample("MPEG DASH - Big Buck Bunny by Blender, Live", "https://wowzaec2demo.streamlock.net/live/bigbuckbunny/manifest_mpm4sav_mvtime.mpd"))
videoSamples.add(Sample("Smooth Stream - Caminandes: Llama Drama by Blender", "http://amssamples.streaming.mediaservices.windows.net/634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest"))
videoSamples.add(Sample("Smooth Stream - Tears of Steel Teaser by Blender", "http://amssamples.streaming.mediaservices.windows.net/3d7eaff9-39fa-442f-81cc-f2ea7db1797e/TearsOfSteelTeaser.ism/manifest"))
videoSamples.add(Sample("WEBM - Big Buck Bunny", "http://dl1.webmfiles.org/big-buck-bunny_trailer.webm"))
videoSamples.add(Sample("WEBM - Elephants Dream", "http://dl1.webmfiles.org/elephants-dream.webm"))
videoSamples.add(Sample("Smooth Stream - Caminandes: Llama Drama by Blender", "https://amssamples.streaming.mediaservices.windows.net/634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest"))
videoSamples.add(Sample("Smooth Stream - Tears of Steel Teaser by Blender", "https://amssamples.streaming.mediaservices.windows.net/3d7eaff9-39fa-442f-81cc-f2ea7db1797e/TearsOfSteelTeaser.ism/manifest"))
videoSamples.add(Sample("WEBM - Big Buck Bunny", "https://dl1.webmfiles.org/big-buck-bunny_trailer.webm"))
videoSamples.add(Sample("WEBM - Elephants Dream", "https://dl1.webmfiles.org/elephants-dream.webm"))
}

fun getAudioSamples(): List<Sample> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.content.Context
import android.media.AudioManager
import android.net.Uri
import android.os.PowerManager
import android.support.annotation.FloatRange
import android.support.annotation.IntRange
import androidx.annotation.FloatRange
import androidx.annotation.IntRange

import com.devbrackets.android.exomedia.AudioPlayer
import com.devbrackets.android.exomediademo.data.MediaItem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.devbrackets.android.exomediademo.playlist

import android.net.Uri
import android.support.annotation.FloatRange
import android.support.annotation.IntRange
import androidx.annotation.FloatRange
import androidx.annotation.IntRange
import com.devbrackets.android.exomedia.ui.widget.VideoView
import com.devbrackets.android.exomediademo.data.MediaItem
import com.devbrackets.android.playlistcore.data.PlaybackState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MediaImageProvider(context: Context, private val onImageUpdated: () -> Uni
private val notificationImageTarget = NotificationImageTarget()
private val remoteViewImageTarget = RemoteViewImageTarget()

private val defaultNotificationImage: Bitmap by lazy { BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher) }
private val defaultNotificationImage: Bitmap? by lazy { BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher) }

private var notificationImage: Bitmap? = null
override var remoteViewArtwork: Bitmap? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.devbrackets.android.exomediademo.ui.activity

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.widget.SeekBar
import com.bumptech.glide.Glide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.devbrackets.android.exomediademo.ui.activity

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.widget.AdapterView
import android.widget.ListView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.devbrackets.android.exomediademo.ui.activity

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.widget.AdapterView
import android.widget.ListView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.devbrackets.android.exomediademo.ui.activity

import android.app.Activity
import android.os.Bundle
import android.support.v7.widget.AppCompatImageButton
import android.support.v7.widget.PopupMenu
import androidx.appcompat.widget.AppCompatImageButton
import androidx.appcompat.widget.PopupMenu
import android.util.Log
import android.view.MenuItem
import com.devbrackets.android.exomedia.ExoMedia
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.devbrackets.android.exomediademo.ui.activity

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.widget.AdapterView
import android.widget.ListView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.devbrackets.android.exomediademo.ui.subtitle

import android.content.Context
import android.support.annotation.IntDef
import androidx.annotation.IntDef
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import android.text.style.AbsoluteSizeSpan
import android.text.style.RelativeSizeSpan
import android.util.DisplayMetrics
import android.util.Log
import com.google.android.exoplayer2.text.CaptionStyleCompat
import com.google.android.exoplayer2.text.Cue
import com.google.android.exoplayer2.ui.CaptionStyleCompat
import com.google.android.exoplayer2.util.Util

/**
Expand Down Expand Up @@ -482,7 +482,7 @@ internal class SubtitlePainter(context: Context) {
* latter only checks the text of each sequence, and does not check for equality of styling that
* may be embedded within the [CharSequence]s.
*/
private fun areCharSequencesEqual(first: CharSequence?, second: CharSequence): Boolean {
private fun areCharSequencesEqual(first: CharSequence?, second: CharSequence?): Boolean {
// Some CharSequence implementations don't perform a cheap referential equality check in their
// equals methods, so we perform one explicitly here.
@Suppress("SuspiciousEqualsCombination")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import android.util.TypedValue
import android.view.View
import android.view.accessibility.CaptioningManager
import com.devbrackets.android.exomedia.core.listener.CaptionListener
import com.google.android.exoplayer2.text.CaptionStyleCompat
import com.google.android.exoplayer2.ui.CaptionStyleCompat
import com.google.android.exoplayer2.text.Cue

@Suppress("MemberVisibilityCanBePrivate", "unused")
Expand Down
8 changes: 4 additions & 4 deletions demo/src/main/res/layout/audio_player_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
android:gravity="center_horizontal"
android:orientation="horizontal">

<android.support.v4.widget.Space
<androidx.legacy.widget.Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
Expand All @@ -93,7 +93,7 @@
tools:ignore="ContentDescription"
tools:visibility="visible"/>

<android.support.v4.widget.Space
<androidx.legacy.widget.Space
android:layout_width="44dp"
android:layout_height="match_parent"/>

Expand All @@ -106,7 +106,7 @@
app:srcCompat="@drawable/playlistcore_ic_play_arrow_black"
tools:ignore="ContentDescription"/>

<android.support.v4.widget.Space
<androidx.legacy.widget.Space
android:layout_width="44dp"
android:layout_height="match_parent"/>

Expand All @@ -122,7 +122,7 @@
tools:ignore="ContentDescription"
tools:visibility="visible"/>

<android.support.v4.widget.Space
<androidx.legacy.widget.Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
before_install:
- sdk install java 11.0.10-open
- sdk use java 11.0.10-open
Loading