diff --git a/app/src/main/java/org/libre/agosto/p2play/singletons/PlaybackSingleton.kt b/app/src/main/java/org/libre/agosto/p2play/singletons/PlaybackSingleton.kt index a6609ac..c299933 100644 --- a/app/src/main/java/org/libre/agosto/p2play/singletons/PlaybackSingleton.kt +++ b/app/src/main/java/org/libre/agosto/p2play/singletons/PlaybackSingleton.kt @@ -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() {