Fix dead thread
This commit is contained in:
parent
8972fdc305
commit
1118c877d7
|
@ -16,16 +16,18 @@ object PlaybackSingleton {
|
|||
var video: VideoModel? = null
|
||||
private var withMediaSession = false
|
||||
|
||||
fun setData(mediaItem: MediaItem, video: VideoModel): ExoPlayer {
|
||||
if (this.player!!.isPlaying) {
|
||||
this.player!!.stop()
|
||||
fun setData(mediaItem: MediaItem, video: VideoModel): ExoPlayer? {
|
||||
player?.let {
|
||||
if (it.isPlaying) {
|
||||
it.stop()
|
||||
}
|
||||
it.setMediaItem(mediaItem)
|
||||
// it.prepare()
|
||||
this.video = video
|
||||
return it
|
||||
}
|
||||
this.player!!.setMediaItem(mediaItem)
|
||||
this.player!!.prepare()
|
||||
|
||||
this.video = video
|
||||
|
||||
return this.player!!
|
||||
return null
|
||||
}
|
||||
|
||||
fun release() {
|
||||
|
|
Loading…
Reference in New Issue