mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 06:28:00 +01:00
Merge pull request #2907 from esensar/exoplayer-media3-migration
Migrate to media3 exoplayer
This commit is contained in:
commit
e2ab0bd643
3 changed files with 24 additions and 23 deletions
|
@ -83,7 +83,7 @@ dependencies {
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.7'
|
implementation 'androidx.media3:media3-exoplayer:1.1.0'
|
||||||
implementation 'com.google.vr:sdk-panowidget:1.180.0'
|
implementation 'com.google.vr:sdk-panowidget:1.180.0'
|
||||||
implementation 'com.google.vr:sdk-videowidget:1.180.0'
|
implementation 'com.google.vr:sdk-videowidget:1.180.0'
|
||||||
implementation 'org.apache.sanselan:sanselan:0.97-incubator'
|
implementation 'org.apache.sanselan:sanselan:0.97-incubator'
|
||||||
|
|
|
@ -15,15 +15,16 @@ import android.util.DisplayMetrics
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import com.google.android.exoplayer2.*
|
import androidx.media3.common.*
|
||||||
import com.google.android.exoplayer2.audio.AudioAttributes
|
import androidx.media3.common.util.UnstableApi
|
||||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
import androidx.media3.datasource.ContentDataSource
|
||||||
import com.google.android.exoplayer2.source.MediaSource
|
import androidx.media3.datasource.DataSource
|
||||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource
|
import androidx.media3.datasource.DataSpec
|
||||||
import com.google.android.exoplayer2.upstream.ContentDataSource
|
import androidx.media3.exoplayer.ExoPlayer
|
||||||
import com.google.android.exoplayer2.upstream.DataSource
|
import androidx.media3.exoplayer.SeekParameters
|
||||||
import com.google.android.exoplayer2.upstream.DataSpec
|
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
||||||
import com.google.android.exoplayer2.video.VideoSize
|
import androidx.media3.exoplayer.source.MediaSource
|
||||||
|
import androidx.media3.exoplayer.source.ProgressiveMediaSource
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.extensions.*
|
import com.simplemobiletools.gallery.pro.extensions.*
|
||||||
|
@ -31,7 +32,7 @@ import com.simplemobiletools.gallery.pro.helpers.*
|
||||||
import kotlinx.android.synthetic.main.activity_video_player.*
|
import kotlinx.android.synthetic.main.activity_video_player.*
|
||||||
import kotlinx.android.synthetic.main.bottom_video_time_holder.*
|
import kotlinx.android.synthetic.main.bottom_video_time_holder.*
|
||||||
|
|
||||||
open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener, TextureView.SurfaceTextureListener {
|
@UnstableApi open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener, TextureView.SurfaceTextureListener {
|
||||||
private val PLAY_WHEN_READY_DRAG_DELAY = 100L
|
private val PLAY_WHEN_READY_DRAG_DELAY = 100L
|
||||||
|
|
||||||
private var mIsFullscreen = false
|
private var mIsFullscreen = false
|
||||||
|
|
|
@ -13,17 +13,18 @@ import android.widget.ImageView
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.media3.common.*
|
||||||
|
import androidx.media3.common.util.UnstableApi
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.google.android.exoplayer2.*
|
import androidx.media3.datasource.ContentDataSource
|
||||||
import com.google.android.exoplayer2.audio.AudioAttributes
|
import androidx.media3.datasource.DataSource
|
||||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
import androidx.media3.datasource.DataSpec
|
||||||
import com.google.android.exoplayer2.source.MediaSource
|
import androidx.media3.datasource.FileDataSource
|
||||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource
|
import androidx.media3.exoplayer.ExoPlayer
|
||||||
import com.google.android.exoplayer2.upstream.ContentDataSource
|
import androidx.media3.exoplayer.SeekParameters
|
||||||
import com.google.android.exoplayer2.upstream.DataSource
|
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
||||||
import com.google.android.exoplayer2.upstream.DataSpec
|
import androidx.media3.exoplayer.source.MediaSource
|
||||||
import com.google.android.exoplayer2.upstream.FileDataSource
|
import androidx.media3.exoplayer.source.ProgressiveMediaSource
|
||||||
import com.google.android.exoplayer2.video.VideoSize
|
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
|
@ -40,7 +41,7 @@ import kotlinx.android.synthetic.main.pager_video_item.view.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
|
|
||||||
class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, SeekBar.OnSeekBarChangeListener {
|
@UnstableApi class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, SeekBar.OnSeekBarChangeListener {
|
||||||
private val PROGRESS = "progress"
|
private val PROGRESS = "progress"
|
||||||
|
|
||||||
private var mIsFullscreen = false
|
private var mIsFullscreen = false
|
||||||
|
@ -673,7 +674,6 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
||||||
mPlayPauseButton.setImageResource(R.drawable.ic_play_outline_vector)
|
mPlayPauseButton.setImageResource(R.drawable.ic_play_outline_vector)
|
||||||
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
mPositionAtPause = mExoPlayer?.currentPosition ?: 0L
|
mPositionAtPause = mExoPlayer?.currentPosition ?: 0L
|
||||||
releaseExoPlayer()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun videoEnded(): Boolean {
|
private fun videoEnded(): Boolean {
|
||||||
|
|
Loading…
Reference in a new issue