Fix dead thread
This commit is contained in:
parent
8972fdc305
commit
1118c877d7
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue