mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
feat: implement cache removal for active video in PlayerScreen
This commit is contained in:
parent
19edc6de61
commit
5bbd0dc6f7
2 changed files with 12 additions and 0 deletions
|
|
@ -1488,6 +1488,14 @@ fun PlayerScreen(
|
||||||
errorMessage = message
|
errorMessage = message
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
controlsVisible = !playerControlsLocked
|
controlsVisible = !playerControlsLocked
|
||||||
|
val currentVideoId = activeVideoId
|
||||||
|
if (currentVideoId != null) {
|
||||||
|
val cacheKey = StreamLinkCacheRepository.contentKey(
|
||||||
|
contentType ?: parentMetaType,
|
||||||
|
currentVideoId,
|
||||||
|
)
|
||||||
|
StreamLinkCacheRepository.remove(cacheKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,10 @@ object StreamLinkCacheRepository {
|
||||||
StreamLinkCacheStorage.saveEntry(hashedKey(contentKey), payload)
|
StreamLinkCacheStorage.saveEntry(hashedKey(contentKey), payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun remove(contentKey: String) {
|
||||||
|
StreamLinkCacheStorage.removeEntry(hashedKey(contentKey))
|
||||||
|
}
|
||||||
|
|
||||||
fun getValid(contentKey: String, maxAgeMs: Long): CachedStreamLink? {
|
fun getValid(contentKey: String, maxAgeMs: Long): CachedStreamLink? {
|
||||||
if (maxAgeMs <= 0L) return null
|
if (maxAgeMs <= 0L) return null
|
||||||
val raw = StreamLinkCacheStorage.loadEntry(hashedKey(contentKey)) ?: return null
|
val raw = StreamLinkCacheStorage.loadEntry(hashedKey(contentKey)) ?: return null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue