This commit is contained in:
tapframe 2026-03-03 02:08:14 +05:30
commit 3d4e22dfee
2 changed files with 8 additions and 5 deletions

View file

@ -106,11 +106,6 @@ object StreamAutoPlaySelector {
StreamAutoPlayMode.FIRST_STREAM -> candidateStreams.firstOrNull { it.getStreamUrl() != null }
StreamAutoPlayMode.REGEX_MATCH -> {
val pattern = regexPattern.trim()
// Skip regex entirely if pattern is blank
if (pattern.isBlank()) {
return null
}
// Try to compile the user regex
val userRegex = runCatching { Regex(pattern, RegexOption.IGNORE_CASE) }.getOrNull() ?: return null

View file

@ -180,6 +180,14 @@ class StreamScreenViewModel @Inject constructor(
directAutoPlayModeInitializedForSession = true
}
val rawRegex = playerSettings.streamAutoPlayRegex.orEmpty().trim()
val isEffectivelyEmptyRegex = rawRegex.isEmpty() || !rawRegex.any { it.isLetterOrDigit() }
if (playerSettings.streamAutoPlayMode == StreamAutoPlayMode.REGEX_MATCH && isEffectivelyEmptyRegex) {
directAutoPlayFlowEnabledForSession = false
autoPlayHandledForSession = true
}
val directFlowActive = directAutoPlayFlowEnabledForSession
var resolvedAutoPlayTarget = false