Fix resuming streamed content (#257)

* Fix resuming streamed content

* Remove debug log statement
This commit is contained in:
Jcuhfehl 2023-01-31 21:19:06 +01:00 committed by GitHub
parent e899a977ab
commit 776ba29e69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -94,7 +94,7 @@ fun loadDownloadedEpisodes(downloadDatabase: DownloadDatabaseDao): List<PlayerIt
name = it.name,
itemId = it.id,
mediaSourceId = "",
playbackPosition = it.playbackPosition ?: 0,
playbackPosition = it.playbackPosition?.div(10000) ?: 0,
mediaSourceUri = File(defaultStorage, it.id.toString()).absolutePath,
parentIndexNumber = it.parentIndexNumber,
indexNumber = it.indexNumber,
@ -134,7 +134,7 @@ fun getDownloadPlayerItem(downloadDatabase: DownloadDatabaseDao, itemId: UUID):
metadata.name,
UUID.fromString(file.name),
"",
metadata.playbackPosition!!,
metadata.playbackPosition!!.div(10000),
file.absolutePath,
metadata.parentIndexNumber,
metadata.indexNumber,

View file

@ -151,7 +151,7 @@ constructor(
Timber.e(e)
}
player.setMediaItems(mediaItems, currentMediaItemIndex, items.getOrNull(currentMediaItemIndex)?.playbackPosition?.div(10000) ?: C.TIME_UNSET)
player.setMediaItems(mediaItems, currentMediaItemIndex, items.getOrNull(currentMediaItemIndex)?.playbackPosition?: C.TIME_UNSET)
if (appPreferences.playerMpv && playFromDownloads) { // For some reason, adding a 1ms delay between these two lines fixes a crash when playing with mpv from downloads
withContext(Dispatchers.IO) {
Thread.sleep(1)