Fix dead thread

This commit is contained in:
Ivan Agosto 2024-04-09 22:59:56 -06:00
parent 8972fdc305
commit 1118c877d7
1 changed files with 10 additions and 8 deletions

View File

@ -16,16 +16,18 @@ object PlaybackSingleton {
var video: VideoModel? = null var video: VideoModel? = null
private var withMediaSession = false private var withMediaSession = false
fun setData(mediaItem: MediaItem, video: VideoModel): ExoPlayer { fun setData(mediaItem: MediaItem, video: VideoModel): ExoPlayer? {
if (this.player!!.isPlaying) { player?.let {
this.player!!.stop() if (it.isPlaying) {
it.stop()
} }
this.player!!.setMediaItem(mediaItem) it.setMediaItem(mediaItem)
this.player!!.prepare() // it.prepare()
this.video = video this.video = video
return it
}
return this.player!! return null
} }
fun release() { fun release() {