kopia lustrzana https://github.com/vitorpamplona/amethyst
Moves video player to the new Exoplayer package
rodzic
4e4e798133
commit
53a4dfb702
|
@ -139,9 +139,9 @@ dependencies {
|
||||||
implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha06'
|
implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha06'
|
||||||
|
|
||||||
// view videos
|
// view videos
|
||||||
implementation "com.google.android.exoplayer:exoplayer:${exoplayer_version}"
|
implementation "androidx.media3:media3-exoplayer:${exoplayer_version}"
|
||||||
// important for proxy / tor
|
// important for proxy / tor
|
||||||
implementation "com.google.android.exoplayer:extension-okhttp:${exoplayer_version}"
|
implementation "androidx.media3:media3-datasource-okhttp:${exoplayer_version}"
|
||||||
|
|
||||||
// Load images from the web.
|
// Load images from the web.
|
||||||
implementation "io.coil-kt:coil-compose:$coil_version"
|
implementation "io.coil-kt:coil-compose:$coil_version"
|
||||||
|
@ -175,6 +175,8 @@ dependencies {
|
||||||
|
|
||||||
// Language picker and Theme chooser
|
// Language picker and Theme chooser
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
|
implementation 'androidx.media3:media3-exoplayer-hls:1.1.0'
|
||||||
|
implementation 'androidx.media3:media3-ui:1.1.0'
|
||||||
|
|
||||||
// Local model for language identification
|
// Local model for language identification
|
||||||
playImplementation 'com.google.mlkit:language-id:17.0.4'
|
playImplementation 'com.google.mlkit:language-id:17.0.4'
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package com.vitorpamplona.amethyst
|
package com.vitorpamplona.amethyst
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.google.android.exoplayer2.database.StandaloneDatabaseProvider
|
import androidx.media3.common.util.UnstableApi
|
||||||
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource
|
import androidx.media3.database.StandaloneDatabaseProvider
|
||||||
import com.google.android.exoplayer2.upstream.cache.CacheDataSource
|
import androidx.media3.datasource.cache.CacheDataSource
|
||||||
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor
|
import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor
|
||||||
import com.google.android.exoplayer2.upstream.cache.SimpleCache
|
import androidx.media3.datasource.cache.SimpleCache
|
||||||
|
import androidx.media3.datasource.okhttp.OkHttpDataSource
|
||||||
import com.vitorpamplona.amethyst.service.HttpClient
|
import com.vitorpamplona.amethyst.service.HttpClient
|
||||||
|
|
||||||
object VideoCache {
|
@UnstableApi object VideoCache {
|
||||||
|
|
||||||
var exoPlayerCacheSize: Long = 90 * 1024 * 1024 // 90MB
|
var exoPlayerCacheSize: Long = 90 * 1024 * 1024 // 90MB
|
||||||
|
|
||||||
|
|
|
@ -49,16 +49,16 @@ import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleEventObserver
|
import androidx.lifecycle.LifecycleEventObserver
|
||||||
import coil.imageLoader
|
import coil.imageLoader
|
||||||
import coil.request.ImageRequest
|
import coil.request.ImageRequest
|
||||||
import com.google.android.exoplayer2.C
|
import androidx.media3.common.C
|
||||||
import com.google.android.exoplayer2.ExoPlayer
|
import androidx.media3.common.MediaItem
|
||||||
import com.google.android.exoplayer2.MediaItem
|
import androidx.media3.common.Player
|
||||||
import com.google.android.exoplayer2.Player
|
import androidx.media3.datasource.DataSource
|
||||||
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource
|
import androidx.media3.datasource.okhttp.OkHttpDataSource
|
||||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource
|
import androidx.media3.exoplayer.ExoPlayer
|
||||||
import com.google.android.exoplayer2.source.hls.HlsMediaSource
|
import androidx.media3.exoplayer.hls.HlsMediaSource
|
||||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
|
import androidx.media3.exoplayer.source.ProgressiveMediaSource
|
||||||
import com.google.android.exoplayer2.ui.StyledPlayerView
|
import androidx.media3.ui.AspectRatioFrameLayout
|
||||||
import com.google.android.exoplayer2.upstream.DataSource
|
import androidx.media3.ui.PlayerView
|
||||||
import com.vitorpamplona.amethyst.VideoCache
|
import com.vitorpamplona.amethyst.VideoCache
|
||||||
import com.vitorpamplona.amethyst.service.HttpClient
|
import com.vitorpamplona.amethyst.service.HttpClient
|
||||||
import com.vitorpamplona.amethyst.service.connectivitystatus.ConnectivityStatus
|
import com.vitorpamplona.amethyst.service.connectivitystatus.ConnectivityStatus
|
||||||
|
@ -175,6 +175,7 @@ fun VideoView(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||||
fun VideoView1(
|
fun VideoView1(
|
||||||
videoUri: String,
|
videoUri: String,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
|
@ -263,6 +264,7 @@ data class VideoThumb(
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||||
private fun RenderVideoPlayer(
|
private fun RenderVideoPlayer(
|
||||||
playerData: VideoPlayer,
|
playerData: VideoPlayer,
|
||||||
thumbData: VideoThumb?,
|
thumbData: VideoThumb?,
|
||||||
|
@ -290,7 +292,7 @@ private fun RenderVideoPlayer(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
factory = {
|
factory = {
|
||||||
StyledPlayerView(context).apply {
|
PlayerView(context).apply {
|
||||||
player = playerData.exoPlayer
|
player = playerData.exoPlayer
|
||||||
layoutParams = FrameLayout.LayoutParams(
|
layoutParams = FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
|
|
@ -8,7 +8,7 @@ buildscript {
|
||||||
accompanist_version = '0.30.0'
|
accompanist_version = '0.30.0'
|
||||||
coil_version = '2.4.0'
|
coil_version = '2.4.0'
|
||||||
vico_version = '1.7.1'
|
vico_version = '1.7.1'
|
||||||
exoplayer_version = '2.19.0'
|
exoplayer_version = '1.1.0'
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.google.gms:google-services:4.3.15'
|
classpath 'com.google.gms:google-services:4.3.15'
|
||||||
|
|
Ładowanie…
Reference in New Issue