diff --git a/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt b/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt index d55d1b1..fe28cba 100644 --- a/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt +++ b/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt @@ -149,7 +149,7 @@ class ReproductorActivity : AppCompatActivity() { runOnUiThread { try { - if (PlaybackSingleton.player == null || !PlaybackSingleton.player!!.playWhenReady) { + if (PlaybackSingleton.player == null || !PlaybackSingleton.player!!.isPlaying) { PlaybackSingleton.player = ExoPlayer.Builder(this) //.setSeekBackIncrementMs(10000) //.setSeekForwardIncrementMs(10000) @@ -160,7 +160,6 @@ class ReproductorActivity : AppCompatActivity() { player = PlaybackSingleton.player!! binding.exoPlayer.player = player - binding.exoPlayer player.addListener( object : Player.Listener { override fun onPlaybackStateChanged(playbackState: Int) { @@ -175,9 +174,6 @@ class ReproductorActivity : AppCompatActivity() { } ) - println("----- video --------") - println(videoPlayback.streamingData?.playlistUrl) - if (!isResume) { val mediaItem = MediaItem.Builder() .setUri(videoPlayback.streamingData?.playlistUrl!!) @@ -192,7 +188,7 @@ class ReproductorActivity : AppCompatActivity() { } // Start the playback. // TODO: Setting for autoplay - // player.play() + player.playWhenReady = true } catch (err: Exception) { err.printStackTrace() } @@ -359,6 +355,10 @@ class ReproductorActivity : AppCompatActivity() { } else { binding.commentBox.commentaryLayout.visibility = View.GONE } + + if (::player.isInitialized && !player.isPlaying) { + binding.exoPlayer.onResume() + } } private fun getDescription() {