Fix buffer, forward and rewind video
This commit is contained in:
parent
8856984dc3
commit
96d8ae19c6
|
@ -19,7 +19,9 @@ import android.widget.ImageView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.media3.common.MediaItem
|
import androidx.media3.common.MediaItem
|
||||||
|
import androidx.media3.exoplayer.DefaultLoadControl
|
||||||
import androidx.media3.exoplayer.ExoPlayer
|
import androidx.media3.exoplayer.ExoPlayer
|
||||||
|
import androidx.media3.exoplayer.upstream.DefaultAllocator
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.squareup.picasso.Picasso
|
import com.squareup.picasso.Picasso
|
||||||
|
@ -114,9 +116,19 @@ class ReproductorActivity : AppCompatActivity() {
|
||||||
|
|
||||||
AsyncTask.execute {
|
AsyncTask.execute {
|
||||||
val video = this.clientVideo.getVideo(this.video.uuid)
|
val video = this.clientVideo.getVideo(this.video.uuid)
|
||||||
|
// TODO: Make this configurable
|
||||||
|
val bufferSize = 1024 * 1024 // 1mb
|
||||||
|
val allocator = DefaultAllocator(true, bufferSize)
|
||||||
|
val loadControl = DefaultLoadControl.Builder()
|
||||||
|
.setAllocator(allocator)
|
||||||
|
.build()
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
try {
|
try {
|
||||||
player = ExoPlayer.Builder(this.baseContext).build()
|
player = ExoPlayer.Builder(this.baseContext)
|
||||||
|
.setSeekBackIncrementMs(10000)
|
||||||
|
.setSeekForwardIncrementMs(10000)
|
||||||
|
.setLoadControl(loadControl).build()
|
||||||
exoPlayer.player = player
|
exoPlayer.player = player
|
||||||
|
|
||||||
println("----- video --------")
|
println("----- video --------")
|
||||||
|
|
Loading…
Reference in New Issue