version 1.0.0 #67

Merged
Seil0 merged 137 commits from develop into master 2022-10-12 15:36:39 +02:00
2 changed files with 3 additions and 7 deletions
Showing only changes of commit 8eb737a831 - Show all commits

View File

@ -85,8 +85,6 @@ class PlayerActivity : AppCompatActivity() {
hideBars() // Initial hide the bars
playerBinding = ActivityPlayerBinding.bind(findViewById(R.id.player_root))
println(findViewById(R.id.player_controls_root))
controlsBinding = PlayerControlsBinding.bind(findViewById(R.id.player_controls_root))
model.loadMediaAsync(

View File

@ -32,10 +32,7 @@ import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.joinAll
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.*
import org.mosad.teapod.R
import org.mosad.teapod.parser.crunchyroll.*
import org.mosad.teapod.preferences.Preferences
@ -276,7 +273,8 @@ class PlayerViewModel(application: Application) : AndroidViewModel(application)
val playhead = (player.currentPosition / 1000)
if (playhead > 0 && Preferences.updatePlayhead) {
viewModelScope.launch { Crunchyroll.postPlayheads(currentEpisode.id, playhead.toInt()) }
// don't use viewModelScope here. This task may needs to finish, when ViewModel will be cleared
CoroutineScope(Dispatchers.IO).launch { Crunchyroll.postPlayheads(currentEpisode.id, playhead.toInt()) }
Log.i(javaClass.name, "Set playhead for episode ${currentEpisode.id} to $playhead sec.")
}