Migrate to media3-exoplayer

This commit is contained in:
Ensar Sarajčić 2023-07-24 08:26:34 +02:00
parent 345f314a44
commit 8aaab1eed3
3 changed files with 24 additions and 22 deletions

View File

@ -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'

View File

@ -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

View File

@ -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