StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Add plugin DRM playback preparation support
Jorge Ceballosc9caca7a1d46
diff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex b160d249..58c967c0 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -137,6 +137,7 @@ dependencies {implementation(libs.media3.exoplayer)implementation(libs.media3.exoplayer.hls)implementation(libs.media3.exoplayer.dash)+ implementation(libs.media3.exoplayer.smoothstreaming)implementation(libs.media3.exoplayer.rtsp)implementation(libs.media3.datasource.okhttp)implementation(libs.media3.ui)diff --git a/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginContract.kt b/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginContract.ktindex 6fc32ca9..053f34a7 100644--- a/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginContract.kt+++ b/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginContract.kt@@ -38,6 +38,10 @@ object StreamVaultPluginContract {const val KEY_PROVIDER_NAME = "provider_name"const val KEY_INPUT_URL = "input_url"const val KEY_OUTPUT_URL = "output_url"+ const val KEY_STREAM_TYPE = "stream_type"+ const val KEY_HEADERS_JSON = "headers_json"+ const val KEY_USER_AGENT = "user_agent"+ const val KEY_DRM_JSON = "drm_json"const val KEY_CONFIGURATION_SCHEMA_JSON = "configuration_schema_json"const val KEY_CONFIGURATION_VALUES_JSON = "configuration_values_json"const val KEY_CONFIGURATION_ACTION_ID = "configuration_action_id"diff --git a/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.kt b/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.ktindex 96e161c8..9386a1bf 100644--- a/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.kt+++ b/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.kt@@ -14,10 +14,14 @@ import androidx.core.content.FileProviderimport com.streamvault.app.BuildConfigimport com.streamvault.app.tvinput.TvInputChannelSyncManagerimport com.streamvault.domain.model.ActiveLiveSource+import com.streamvault.domain.model.DrmInfo+import com.streamvault.domain.model.DrmSchemeimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.Result+import com.streamvault.domain.model.StreamInfo+import com.streamvault.domain.model.StreamTypeimport com.streamvault.domain.repository.CombinedM3uRepositoryimport com.streamvault.domain.repository.ProviderRepositoryimport dagger.hilt.android.qualifiers.ApplicationContext@@ -33,6 +37,7 @@ import kotlinx.serialization.json.Jsonimport kotlinx.serialization.json.JsonObjectimport okhttp3.OkHttpClientimport okhttp3.Request+import org.json.JSONObject@Singletonclass StreamVaultPluginManager @Inject constructor(@@ -256,8 +261,12 @@ class StreamVaultPluginManager @Inject constructor(response.toPluginActionResult("Plugin action completed")}- suspend fun preparePlaybackUrl(url: String): Result<Unit> = withContext(Dispatchers.IO) {- if (url.isBlank()) return@withContext Result.success(Unit)+ suspend fun preparePlaybackUrl(url: String): Result<Unit> =+ preparePlaybackStreamInfo(StreamInfo(url = url)).map { Unit }++ suspend fun preparePlaybackStreamInfo(streamInfo: StreamInfo): Result<StreamInfo> = withContext(Dispatchers.IO) {+ val url = streamInfo.url+ if (url.isBlank()) return@withContext Result.success(streamInfo)val plugins = discoverPlugins().filter { it.enabled && it.manifest.hasCapability(StreamVaultPluginContract.CAPABILITY_PLAYBACK_PREPARE) }for (plugin in plugins) {@@ -273,14 +282,14 @@ class StreamVaultPluginManager @Inject constructor(if (!response.getBoolean(StreamVaultPluginContract.KEY_HANDLED, false)) continueif (response.getBoolean(StreamVaultPluginContract.KEY_SUCCESS, false)) {- return@withContext Result.success(Unit)+ return@withContext Result.success(applyPlaybackPreparationResponse(streamInfo, response))}return@withContext Result.error(response.getString(StreamVaultPluginContract.KEY_MESSAGE).orEmpty().ifBlank { "${plugin.displayName} could not prepare playback" })}- Result.success(Unit)+ Result.success(streamInfo)}suspend fun rewriteCastUrl(url: String): String? = withContext(Dispatchers.IO) {@@ -306,6 +315,84 @@ class StreamVaultPluginManager @Inject constructor(url}+ private fun applyPlaybackPreparationResponse(+ streamInfo: StreamInfo,+ response: Bundle+ ): StreamInfo {+ val outputUrl = response.getString(StreamVaultPluginContract.KEY_OUTPUT_URL).orEmpty()+ .ifBlank { streamInfo.url }+ val responseHeaders = parseHeadersJson(response.getString(StreamVaultPluginContract.KEY_HEADERS_JSON).orEmpty())+ val responseUserAgent = response.getString(StreamVaultPluginContract.KEY_USER_AGENT)+ ?.takeIf { it.isNotBlank() }+ val streamType = parsePluginStreamType(response.getString(StreamVaultPluginContract.KEY_STREAM_TYPE))+ ?: streamInfo.streamType+ val drmInfo = parsePluginDrmInfo(response.getString(StreamVaultPluginContract.KEY_DRM_JSON))+ ?: streamInfo.drmInfo+ return streamInfo.copy(+ url = outputUrl,+ headers = streamInfo.headers + responseHeaders,+ userAgent = responseUserAgent ?: streamInfo.userAgent,+ streamType = streamType,+ containerExtension = streamInfo.containerExtension ?: streamType.defaultContainerExtension(),+ drmInfo = drmInfo+ )+ }++ private fun parseHeadersJson(raw: String): Map<String, String> =+ runCatching {+ if (raw.isBlank()) return@runCatching emptyMap()+ val jsonObject = JSONObject(raw)+ val headers = linkedMapOf<String, String>()+ jsonObject.keys().forEach { key ->+ val value = jsonObject.optString(key).takeIf { it.isNotBlank() } ?: return@forEach+ if (key.isSafeHttpHeaderName()) headers[key] = value+ }+ headers+ }.getOrDefault(emptyMap())++ private fun parsePluginDrmInfo(raw: String?): DrmInfo? =+ runCatching {+ if (raw.isNullOrBlank()) return@runCatching null+ val jsonObject = JSONObject(raw)+ val scheme = parsePluginDrmScheme(jsonObject.optString("scheme")) ?: return@runCatching null+ val licenseUrl = jsonObject.optString("licenseUrl").ifBlank {+ jsonObject.optString("license_url")+ }+ if (licenseUrl.isBlank()) return@runCatching null+ DrmInfo(+ scheme = scheme,+ licenseUrl = licenseUrl,+ headers = parseHeadersJson(jsonObject.optJSONObject("headers")?.toString().orEmpty()),+ multiSession = jsonObject.optBoolean("multiSession", false),+ forceDefaultLicenseUrl = jsonObject.optBoolean("forceDefaultLicenseUrl", true),+ playClearContentWithoutKey = jsonObject.optBoolean("playClearContentWithoutKey", true)+ )+ }.getOrNull()++ private fun parsePluginDrmScheme(raw: String): DrmScheme? {+ val normalized = raw.trim().lowercase()+ return when {+ normalized == "widevine" || normalized == "com.widevine.alpha" -> DrmScheme.WIDEVINE+ normalized == "playready" || normalized == "com.microsoft.playready" -> DrmScheme.PLAYREADY+ normalized == "clearkey" || normalized == "org.w3.clearkey" -> DrmScheme.CLEARKEY+ else -> null+ }+ }++ private fun parsePluginStreamType(raw: String?): StreamType? {+ val normalized = raw.orEmpty().trim().lowercase()+ return when (normalized) {+ "dash", "mpd", "application/dash+xml" -> StreamType.DASH+ "smooth_streaming", "smoothstreaming", "smooth-streaming", "ss", "ism", "isml",+ "application/vnd.ms-sstr+xml" -> StreamType.SMOOTH_STREAMING+ "hls", "m3u8", "application/vnd.apple.mpegurl", "application/x-mpegurl" -> StreamType.HLS+ "mpeg_ts", "mpeg-ts", "ts" -> StreamType.MPEG_TS+ "progressive", "file" -> StreamType.PROGRESSIVE+ "rtsp", "rtsps" -> StreamType.RTSP+ else -> null+ }+ }+private suspend fun syncPluginProvider(plugin: InstalledStreamVaultPlugin,onProgress: (String) -> Unit@@ -571,6 +658,21 @@ private fun kotlinx.coroutines.CoroutineScope.launchCatching(block: suspend () -launch { runCatching { block() } }}+private fun StreamType.defaultContainerExtension(): String? = when (this) {+ StreamType.DASH -> "mpd"+ StreamType.SMOOTH_STREAMING -> "ism"+ StreamType.HLS -> "m3u8"+ StreamType.MPEG_TS -> "ts"+ StreamType.PROGRESSIVE,+ StreamType.RTSP,+ StreamType.UNKNOWN -> null+}++private fun String.isSafeHttpHeaderName(): Boolean =+ isNotBlank() && all { char ->+ char.isLetterOrDigit() || char in setOf('!', '#', '$', '%', '&', '\'', '*', '+', '.', '^', '_', '`', '|', '~', '-')+ }+@Suppress("DEPRECATION")private fun Bundle.metaString(key: String): String = when (val value = get(key)) {is String -> valuediff --git a/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt b/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.ktindex d040dcd2..9728d513 100644--- a/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt+++ b/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt@@ -17,6 +17,7 @@ import androidx.media3.exoplayer.ExoPlayerimport androidx.media3.exoplayer.dash.DashMediaSourceimport androidx.media3.exoplayer.hls.HlsMediaSourceimport androidx.media3.exoplayer.rtsp.RtspMediaSource+import androidx.media3.exoplayer.smoothstreaming.SsMediaSourceimport androidx.media3.exoplayer.source.MediaSourceimport androidx.media3.exoplayer.source.ProgressiveMediaSourceimport com.streamvault.domain.model.Channel@@ -117,6 +118,7 @@ class StreamVaultTvInputService : TvInputService() {return when (streamType) {StreamType.HLS -> HlsMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)StreamType.DASH -> DashMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)+ StreamType.SMOOTH_STREAMING -> SsMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)StreamType.RTSP -> RtspMediaSource.Factory().createMediaSource(mediaItem)StreamType.MPEG_TS,StreamType.PROGRESSIVE,@@ -137,6 +139,8 @@ class StreamVaultTvInputService : TvInputService() {return when {url.endsWith(".m3u8") -> StreamType.HLSurl.endsWith(".mpd") -> StreamType.DASH+ url.contains(".isml/manifest") || url.contains(".ism/manifest") || url.endsWith(".ism") || url.endsWith(".isml") ->+ StreamType.SMOOTH_STREAMINGurl.startsWith("rtsp") -> StreamType.RTSPurl.endsWith(".ts") -> StreamType.MPEG_TSelse -> StreamType.PROGRESSIVE@@ -178,4 +182,4 @@ class StreamVaultTvInputService : TvInputService() {const val CHANNEL_COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data"const val ENTRY_SEPARATOR = ":"}-}\ No newline at end of file+}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.ktindex d10aec22..e06823de 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt@@ -4,6 +4,7 @@ import androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScopeimport com.streamvault.app.di.AuxiliaryPlayerEngineimport com.streamvault.app.player.LivePreviewHandoffManager+import com.streamvault.app.plugins.StreamVaultPluginManagerimport com.streamvault.app.tvinput.TvInputChannelSyncManagerimport com.streamvault.app.ui.screens.multiview.MultiViewManagerimport com.streamvault.app.ui.model.applyProviderCategoryDisplayPreferences@@ -30,6 +31,7 @@ import com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.Resultimport com.streamvault.domain.model.StreamInfo+import com.streamvault.domain.model.StreamTypeimport com.streamvault.domain.model.SyncStateimport com.streamvault.domain.model.VirtualCategoryIdsimport com.streamvault.domain.repository.CategoryRepository@@ -55,6 +57,7 @@ import kotlinx.coroutines.Jobimport kotlinx.coroutines.asyncimport kotlinx.coroutines.awaitAllimport kotlinx.coroutines.coroutineScope+import kotlinx.coroutines.delayimport kotlinx.coroutines.flow.*import kotlinx.coroutines.launchimport javax.inject.Inject@@ -80,7 +83,8 @@ class HomeViewModel @Inject constructor(private val tvInputChannelSyncManager: TvInputChannelSyncManager,private val multiViewManager: MultiViewManager,private val livePreviewHandoffManager: LivePreviewHandoffManager,- @AuxiliaryPlayerEngine+ private val pluginManager: StreamVaultPluginManager,+ @param:AuxiliaryPlayerEngineprivate val playerEngineProvider: InjectProvider<PlayerEngine>) : ViewModel() {private companion object {@@ -88,6 +92,7 @@ class HomeViewModel @Inject constructor(const val CHANNEL_PAGE_SIZE = 200const val CHANNEL_SEARCH_PAGE_SIZE = 300const val LOAD_MORE_THRESHOLD = 5+ const val ADAPTIVE_PREVIEW_REPRIME_DELAY_MS = 2_500L}private val appContext = application@@ -1021,16 +1026,37 @@ class HomeViewModel @Inject constructor(viewModelScope.launch {when (val result = channelRepository.getStreamInfo(channel)) {is Result.Success -> {+ if (!isActivePreviewSession(previewVersion, channel.id)) return@launch+ val preparedStreamInfo = when (val pluginResult = pluginManager.preparePlaybackStreamInfo(result.data)) {+ is Result.Success -> pluginResult.data+ is Result.Error -> {+ if (!isActivePreviewSession(previewVersion, channel.id)) return@launch+ _uiState.update {+ it.copy(+ isPreviewLoading = false,+ previewErrorMessage = pluginResult.message.ifBlank { appContext.getString(R.string.live_preview_failed) }+ )+ }+ return@launch+ }+ Result.Loading -> result.data+ }if (!isActivePreviewSession(previewVersion, channel.id)) return@launchengine.stop()engine.setDecoderMode(preferencesRepository.playerDecoderMode.first())engine.setSurfaceMode(preferencesRepository.playerSurfaceMode.first())- engine.prepare(result.data)+ engine.prepare(preparedStreamInfo)engine.setVolume(1f)engine.play()livePreviewHandoffManager.registerPreviewSession(channel = channel,- streamInfo = result.data,+ streamInfo = preparedStreamInfo,+ engine = engine+ )+ scheduleAdaptivePreviewReprime(+ previewVersion = previewVersion,+ channel = channel,+ streamInfo = preparedStreamInfo,engine = engine)}@@ -1048,6 +1074,32 @@ class HomeViewModel @Inject constructor(}}+ private fun scheduleAdaptivePreviewReprime(+ previewVersion: Long,+ channel: Channel,+ streamInfo: StreamInfo,+ engine: PlayerEngine+ ) {+ if (!streamInfo.needsAdaptivePreviewReprime()) return++ viewModelScope.launch {+ delay(ADAPTIVE_PREVIEW_REPRIME_DELAY_MS)+ if (!isActivePreviewSession(previewVersion, channel.id)) return@launch+ if (_uiState.value.previewErrorMessage != null) return@launch+ if (engine.playbackState.value != PlaybackState.READY) return@launch+ if (!engine.isPlaying.value) return@launch+ if (engine.playerStats.value.ttffMs > 0L) return@launch++ engine.renewStreamUrl(streamInfo)+ engine.play()+ }+ }++ private fun StreamInfo.needsAdaptivePreviewReprime(): Boolean {+ if (drmInfo == null) return false+ return streamType == StreamType.DASH || streamType == StreamType.SMOOTH_STREAMING+ }+fun beginPreviewHandoff(channel: Channel): Boolean {val engine = previewPlayerEngine ?: return falseif (_uiState.value.previewChannelId != channel.id) return falsediff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex 813b1caa..b267c119 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -1122,7 +1122,8 @@ class PlayerViewModel @Inject constructor(return false}- when (val pluginPrepareResult = pluginManager.preparePlaybackUrl(streamInfo.url)) {+ var preparedStreamInfo = streamInfo+ when (val pluginPrepareResult = pluginManager.preparePlaybackStreamInfo(streamInfo)) {is Result.Error -> {if (!isActivePlaybackSession(requestVersion)) return falsesetLastFailureReason(pluginPrepareResult.message)@@ -1134,10 +1135,10 @@ class PlayerViewModel @Inject constructor(return false}Result.Loading -> Unit- is Result.Success -> Unit+ is Result.Success -> preparedStreamInfo = pluginPrepareResult.data}- probePlaybackUrl(streamInfo)?.let { failure ->+ probePlaybackUrl(preparedStreamInfo)?.let { failure ->if (!isActivePlaybackSession(requestVersion)) return falsesetLastFailureReason(failure.message)showPlayerNotice(@@ -1155,11 +1156,11 @@ class PlayerViewModel @Inject constructor()applyPlaybackPreferences()if (!isActivePlaybackSession(requestVersion)) return false- currentResolvedPlaybackUrl = streamInfo.url- currentResolvedStreamInfo = streamInfo+ currentResolvedPlaybackUrl = preparedStreamInfo.url+ currentResolvedStreamInfo = preparedStreamInforeadySideEffectsRequestVersion = requestVersion- playerEngine.prepare(streamInfo)- startTokenRenewalMonitoring(streamInfo.expirationTime)+ playerEngine.prepare(preparedStreamInfo)+ startTokenRenewalMonitoring(preparedStreamInfo.expirationTime)return true}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModelActions.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModelActions.ktindex 7d61e898..d3ff87d1 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModelActions.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModelActions.kt@@ -199,6 +199,7 @@ internal fun StreamInfo.toCastRequest(val mimeType = when (inferCastStreamType()) {StreamType.HLS -> "application/x-mpegURL"StreamType.DASH -> "application/dash+xml"+ StreamType.SMOOTH_STREAMING -> "application/vnd.ms-sstr+xml"StreamType.MPEG_TS -> "video/mp2t"StreamType.RTSP -> return nullStreamType.PROGRESSIVE,@@ -223,6 +224,8 @@ internal fun StreamInfo.inferCastStreamType(): StreamType {return when {normalizedUrl.endsWith(".m3u8") -> StreamType.HLSnormalizedUrl.endsWith(".mpd") -> StreamType.DASH+ normalizedUrl.contains(".isml/manifest") || normalizedUrl.contains(".ism/manifest") ||+ normalizedUrl.endsWith(".ism") || normalizedUrl.endsWith(".isml") -> StreamType.SMOOTH_STREAMINGnormalizedUrl.endsWith(".ts") -> StreamType.MPEG_TSnormalizedUrl.startsWith("rtsp") -> StreamType.RTSPelse -> StreamType.PROGRESSIVEdiff --git a/app/src/main/java/com/streamvault/app/ui/screens/plugins/PluginsScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/plugins/PluginsScreen.ktindex 7a9a9034..3ab8c076 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/plugins/PluginsScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/plugins/PluginsScreen.kt@@ -5,8 +5,9 @@ import androidx.activity.result.contract.ActivityResultContractsimport androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.horizontalScroll+import androidx.compose.foundation.text.KeyboardActions+import androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.RowScope@@ -34,12 +35,14 @@ import androidx.compose.runtime.rememberimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier-import androidx.compose.ui.draw.clip+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.graphics.Color-import androidx.compose.ui.text.input.KeyboardType+import androidx.compose.ui.platform.LocalSoftwareKeyboardController+import androidx.compose.ui.text.input.ImeActionimport androidx.compose.ui.text.input.PasswordVisualTransformation+import androidx.compose.ui.text.input.KeyboardTypeimport androidx.compose.ui.text.input.VisualTransformation-import androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dpimport androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel@@ -53,6 +56,8 @@ import com.streamvault.app.plugins.InstalledStreamVaultPluginimport com.streamvault.app.plugins.PluginConfigurationActionimport com.streamvault.app.plugins.PluginConfigurationFieldimport com.streamvault.app.plugins.PluginConfigurationSection+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButtonimport com.streamvault.app.ui.components.shell.AppNavigationChromeimport com.streamvault.app.ui.components.shell.AppScreenScaffoldimport com.streamvault.app.ui.components.shell.StatusPill@@ -72,6 +77,7 @@ fun PluginsScreen() {val uiState by viewModel.uiState.collectAsStateWithLifecycle()val snackbarHostState = remember { SnackbarHostState() }+ var showInstallUrlDialog by remember { mutableStateOf(false) }val apkPicker = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->if (uri != null) viewModel.installFromLocalUri(uri)}@@ -108,10 +114,8 @@ fun PluginsScreen()} else {PluginInstallPanel(- installUrl = uiState.installUrl,isInstalling = uiState.isInstalling,- onInstallUrlChange = viewModel::updateInstallUrl,- onInstallFromUrl = viewModel::installFromUrl,+ onInstallFromUrl = { showInstallUrlDialog = true },onInstallFromFile = {apkPicker.launch(arrayOf(@@ -124,6 +128,19 @@ fun PluginsScreen(onRefresh = viewModel::refreshPlugins)+ if (showInstallUrlDialog) {+ PluginInstallUrlDialog(+ installUrl = uiState.installUrl,+ isInstalling = uiState.isInstalling,+ onInstallUrlChange = viewModel::updateInstallUrl,+ onDismiss = { showInstallUrlDialog = false },+ onInstall = {+ showInstallUrlDialog = false+ viewModel.installFromUrl()+ }+ )+ }+uiState.syncProgress?.let {Text(text = it,@@ -219,9 +236,7 @@ private fun PluginButton(@Composableprivate fun PluginInstallPanel(- installUrl: String,isInstalling: Boolean,- onInstallUrlChange: (String) -> Unit,onInstallFromUrl: () -> Unit,onInstallFromFile: () -> Unit,onRefresh: () -> Unit@@ -238,24 +253,8 @@ private fun PluginInstallPanel(horizontalArrangement = Arrangement.spacedBy(10.dp),verticalAlignment = Alignment.CenterVertically) {- OutlinedTextField(- value = installUrl,- onValueChange = onInstallUrlChange,- modifier = Modifier.weight(1f),- singleLine = true,- label = { androidx.compose.material3.Text("Plugin APK URL") },- colors = OutlinedTextFieldDefaults.colors(- focusedTextColor = AppColors.TextPrimary,- unfocusedTextColor = AppColors.TextPrimary,- focusedBorderColor = AppColors.Brand,- unfocusedBorderColor = AppColors.Outline,- focusedLabelColor = AppColors.Brand,- unfocusedLabelColor = AppColors.TextSecondary,- cursorColor = AppColors.Brand- )- )PluginButton(- enabled = !isInstalling && installUrl.isNotBlank(),+ enabled = !isInstalling,onClick = onInstallFromUrl,tone = PluginButtonTone.Primary) {@@ -279,6 +278,87 @@ private fun PluginInstallPanel(}}+@Composable+private fun PluginInstallUrlDialog(+ installUrl: String,+ isInstalling: Boolean,+ onInstallUrlChange: (String) -> Unit,+ onDismiss: () -> Unit,+ onInstall: () -> Unit+) {+ val focusRequester = remember { FocusRequester() }+ val keyboardController = LocalSoftwareKeyboardController.current+ val normalizedUrl = installUrl.trim()++ fun submitUrl() {+ if (!isInstalling && normalizedUrl.isNotBlank()) {+ keyboardController?.hide()+ onInstall()+ }+ }++ LaunchedEffect(Unit) {+ runCatching { focusRequester.requestFocus() }+ keyboardController?.show()+ }++ PremiumDialog(+ title = "Install plugin from URL",+ subtitle = "Enter the direct APK URL. StreamVault will download it and open the installer.",+ onDismissRequest = {+ keyboardController?.hide()+ if (!isInstalling) onDismiss()+ },+ widthFraction = 0.5f,+ heightFraction = null,+ content = {+ OutlinedTextField(+ value = installUrl,+ onValueChange = onInstallUrlChange,+ modifier = Modifier+ .fillMaxWidth()+ .focusRequester(focusRequester),+ enabled = !isInstalling,+ singleLine = true,+ label = { androidx.compose.material3.Text("Plugin APK URL") },+ keyboardOptions = KeyboardOptions(+ keyboardType = KeyboardType.Uri,+ imeAction = ImeAction.Done+ ),+ keyboardActions = KeyboardActions(onDone = { submitUrl() }),+ colors = OutlinedTextFieldDefaults.colors(+ focusedTextColor = AppColors.TextPrimary,+ unfocusedTextColor = AppColors.TextPrimary,+ disabledTextColor = AppColors.TextSecondary,+ focusedBorderColor = AppColors.Brand,+ unfocusedBorderColor = AppColors.Outline,+ disabledBorderColor = AppColors.Outline.copy(alpha = 0.4f),+ focusedLabelColor = AppColors.Brand,+ unfocusedLabelColor = AppColors.TextSecondary,+ disabledLabelColor = AppColors.TextTertiary,+ cursorColor = AppColors.Brand+ )+ )+ },+ footer = {+ PremiumDialogFooterButton(+ label = "Cancel",+ onClick = {+ keyboardController?.hide()+ onDismiss()+ },+ enabled = !isInstalling+ )+ PremiumDialogFooterButton(+ label = if (isInstalling) "Installing..." else "Download and install",+ onClick = ::submitUrl,+ enabled = !isInstalling && normalizedUrl.isNotBlank(),+ emphasized = true+ )+ }+ )+}+@Composableprivate fun PluginCard(plugin: InstalledStreamVaultPlugin,diff --git a/docs/PLUGIN_API.md b/docs/PLUGIN_API.mdindex 767b9bf6..a5a08a28 100644--- a/docs/PLUGIN_API.md+++ b/docs/PLUGIN_API.md@@ -149,6 +149,35 @@ For `playback.prepare` and `cast.rewriteUrl`, plugins should set`handled=false` when the URL is not theirs. StreamVault then continues with otherenabled plugins or the original URL.+`MSG_PREPARE_PLAYBACK` may also enrich the stream that StreamVault sends to the+player. When `handled=true` and `success=true`, the plugin can return:++- `output_url`: final playable URL. If omitted, StreamVault keeps `input_url`.+- `stream_type`: optional playback hint. Supported values are `DASH`, `HLS`,+ `SMOOTH_STREAMING`, `MPEG_TS`, `PROGRESSIVE`, and `RTSP`.+- `headers_json`: JSON object with HTTP request headers for the media request.+- `user_agent`: optional user agent applied to the media request.+- `drm_json`: JSON object with DRM information:++```json+{+ "scheme": "clearkey",+ "licenseUrl": "http://127.0.0.1:39077/license/clearkey/channel-id",+ "headers": {+ "Authorization": "Bearer token"+ },+ "multiSession": false,+ "forceDefaultLicenseUrl": true,+ "playClearContentWithoutKey": true+}+```++`scheme` accepts `widevine`, `playready`, `clearkey`, or their platform UUID+aliases (`com.widevine.alpha`, `com.microsoft.playready`, `org.w3.clearkey`).+For `SMOOTH_STREAMING` + `clearkey`, StreamVault normalizes the ISML+`ProtectionHeader` into ClearKey PSSH v1 init data before creating the Android+MediaDrm session.+## Choosing a Configuration ModePlugins should choose one primary configuration mode.diff --git a/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt b/domain/src/main/java/com/streamvault/domain/model/StreamInfo.ktindex a2c179d5..1432fcdd 100644--- a/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt+++ b/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt@@ -44,6 +44,7 @@ enum class DrmScheme {enum class StreamType {HLS,DASH,+ SMOOTH_STREAMING,MPEG_TS,PROGRESSIVE,RTSP, // PE-H03: native RTSP via Media3 RtspMediaSource@@ -55,6 +56,7 @@ enum class StreamType {"ts" -> MPEG_TS"m3u8" -> HLS"mpd" -> DASH+ "ism", "isml" -> SMOOTH_STREAMING"mp4", "mkv", "avi", "mov", "mp3", "aac", "m4a", "flv", "webm" -> PROGRESSIVEelse -> UNKNOWN}diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 62e1358d..d5ba3edd 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -54,6 +54,7 @@ compose-tv-material = { group = "androidx.tv", name = "tv-material", version.refmedia3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" }media3-exoplayer-hls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "media3" }media3-exoplayer-dash = { group = "androidx.media3", name = "media3-exoplayer-dash", version.ref = "media3" }+media3-exoplayer-smoothstreaming = { group = "androidx.media3", name = "media3-exoplayer-smoothstreaming", version.ref = "media3" }media3-exoplayer-rtsp = { group = "androidx.media3", name = "media3-exoplayer-rtsp", version.ref = "media3" }media3-datasource-okhttp = { group = "androidx.media3", name = "media3-datasource-okhttp", version.ref = "media3" }media3-session = { group = "androidx.media3", name = "media3-session", version.ref = "media3" }diff --git a/player/build.gradle.kts b/player/build.gradle.ktsindex 13a096cb..97c196e9 100644--- a/player/build.gradle.kts+++ b/player/build.gradle.kts@@ -92,6 +92,7 @@ dependencies {implementation(libs.media3.exoplayer)implementation(libs.media3.exoplayer.hls)implementation(libs.media3.exoplayer.dash)+ implementation(libs.media3.exoplayer.smoothstreaming)implementation(libs.media3.exoplayer.rtsp) // PE-H03: RTSP stream supportimplementation(libs.media3.datasource.okhttp)implementation(libs.media3.session)diff --git a/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt b/player/src/main/java/com/streamvault/player/Media3PlayerEngine.ktindex ff5164db..93e1236a 100644--- a/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt+++ b/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt@@ -832,7 +832,10 @@ class Media3PlayerEngine @Inject constructor(policyModeFor(requestedDecoderMode, preferredDecoderMode))val isLiveBuffer = currentResolvedStreamType in setOf(- ResolvedStreamType.HLS, ResolvedStreamType.MPEG_TS_LIVE, ResolvedStreamType.RTSP+ ResolvedStreamType.HLS,+ ResolvedStreamType.SMOOTH_STREAMING,+ ResolvedStreamType.MPEG_TS_LIVE,+ ResolvedStreamType.RTSP)val previousDecoderPolicy = activeDecoderPolicyval needsRecreate = activeDecoderMode != preferredDecoderMode ||@@ -876,7 +879,10 @@ class Media3PlayerEngine @Inject constructor(seekPositionMs?.takeIf { it > 0L }?.let(player::seekTo)val isLive = currentResolvedStreamType in setOf(- ResolvedStreamType.HLS, ResolvedStreamType.MPEG_TS_LIVE, ResolvedStreamType.RTSP+ ResolvedStreamType.HLS,+ ResolvedStreamType.SMOOTH_STREAMING,+ ResolvedStreamType.MPEG_TS_LIVE,+ ResolvedStreamType.RTSP)val osContentType = if (isLive) {android.media.AudioAttributes.CONTENT_TYPE_MUSIC@@ -1622,6 +1628,7 @@ class Media3PlayerEngine @Inject constructor(private fun isCurrentStreamLive(): Boolean = currentResolvedStreamType in setOf(ResolvedStreamType.HLS,+ ResolvedStreamType.SMOOTH_STREAMING,ResolvedStreamType.MPEG_TS_LIVE,ResolvedStreamType.RTSP)diff --git a/player/src/main/java/com/streamvault/player/StreamTypeDetector.kt b/player/src/main/java/com/streamvault/player/StreamTypeDetector.ktindex ece39d8c..341ed651 100644--- a/player/src/main/java/com/streamvault/player/StreamTypeDetector.kt+++ b/player/src/main/java/com/streamvault/player/StreamTypeDetector.kt@@ -10,6 +10,7 @@ object StreamTypeDetector {return when (StreamTypeResolver.resolve(url = url, isLive = url.contains("/live/", ignoreCase = true))) {ResolvedStreamType.HLS -> StreamType.HLSResolvedStreamType.DASH -> StreamType.DASH+ ResolvedStreamType.SMOOTH_STREAMING -> StreamType.SMOOTH_STREAMINGResolvedStreamType.MPEG_TS_LIVE -> StreamType.MPEG_TSResolvedStreamType.PROGRESSIVE -> StreamType.PROGRESSIVEResolvedStreamType.RTSP -> StreamType.RTSPdiff --git a/player/src/main/java/com/streamvault/player/playback/ClearKeySmoothStreamingManifestParser.kt b/player/src/main/java/com/streamvault/player/playback/ClearKeySmoothStreamingManifestParser.ktnew file mode 100644index 00000000..ee746029--- /dev/null+++ b/player/src/main/java/com/streamvault/player/playback/ClearKeySmoothStreamingManifestParser.kt@@ -0,0 +1,80 @@+package com.streamvault.player.playback++import android.net.Uri+import androidx.media3.common.C+import androidx.media3.common.DrmInitData+import androidx.media3.common.MimeTypes+import androidx.media3.common.util.UnstableApi+import androidx.media3.exoplayer.smoothstreaming.manifest.SsManifest+import androidx.media3.exoplayer.smoothstreaming.manifest.SsManifestParser+import androidx.media3.exoplayer.upstream.ParsingLoadable+import androidx.media3.extractor.mp4.PsshAtomUtil+import java.io.InputStream+import java.nio.ByteBuffer+import java.util.UUID++@UnstableApi+internal class ClearKeySmoothStreamingManifestParser(+ private val delegate: SsManifestParser = SsManifestParser()+) : ParsingLoadable.Parser<SsManifest> {++ override fun parse(uri: Uri, inputStream: InputStream): SsManifest {+ val manifest = delegate.parse(uri, inputStream)+ val protection = manifest.protectionElement ?: return manifest+ val keyIds = protection.trackEncryptionBoxes+ .mapNotNull { box -> box.cryptoData.encryptionKey?.takeIf { it.size == KEY_ID_SIZE } }+ .distinctBy { it.contentToString() }+ .map { it.toUuid() }++ if (keyIds.isEmpty()) return manifest++ // Android ClearKey expects CENC init data as PSSH v1 with KID entries.+ val clearKeyPssh = PsshAtomUtil.buildPsshAtom(C.CLEARKEY_UUID, keyIds.toTypedArray(), null)+ val patchedProtection = SsManifest.ProtectionElement(+ C.CLEARKEY_UUID,+ clearKeyPssh,+ protection.trackEncryptionBoxes+ )+ val drmInitData = DrmInitData(+ DrmInitData.SchemeData(C.CLEARKEY_UUID, MimeTypes.VIDEO_MP4, clearKeyPssh)+ )+ val patchedElements = manifest.streamElements.map { element ->+ if (element.type == C.TRACK_TYPE_AUDIO || element.type == C.TRACK_TYPE_VIDEO) {+ element.copy(+ element.formats.map { format ->+ format.buildUpon()+ .setDrmInitData(drmInitData)+ .build()+ }.toTypedArray()+ )+ } else {+ element+ }+ }.toTypedArray()++ return SsManifest(+ manifest.majorVersion,+ manifest.minorVersion,+ MANIFEST_TIME_SCALE,+ manifest.durationUs.toManifestDuration(),+ manifest.dvrWindowLengthUs.toManifestDuration(),+ manifest.lookAheadCount,+ manifest.isLive,+ patchedProtection,+ patchedElements+ )+ }++ private fun Long.toManifestDuration(): Long =+ if (this == C.TIME_UNSET) 0L else this++ private fun ByteArray.toUuid(): UUID {+ val buffer = ByteBuffer.wrap(this)+ return UUID(buffer.long, buffer.long)+ }++ private companion object {+ private const val KEY_ID_SIZE = 16+ private const val MANIFEST_TIME_SCALE = 1_000_000L+ }+}diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerMediaSourceFactory.kt b/player/src/main/java/com/streamvault/player/playback/PlayerMediaSourceFactory.ktindex db7f4fe8..f8617f9c 100644--- a/player/src/main/java/com/streamvault/player/playback/PlayerMediaSourceFactory.kt+++ b/player/src/main/java/com/streamvault/player/playback/PlayerMediaSourceFactory.kt@@ -2,6 +2,7 @@ package com.streamvault.player.playbackimport android.net.Uriimport android.util.Log+import androidx.media3.common.Cimport androidx.media3.common.Formatimport androidx.media3.common.MediaItemimport androidx.media3.common.MimeTypes@@ -12,6 +13,7 @@ import androidx.media3.extractor.ts.DefaultTsPayloadReaderFactoryimport androidx.media3.exoplayer.dash.DashMediaSourceimport androidx.media3.exoplayer.hls.HlsMediaSourceimport androidx.media3.exoplayer.rtsp.RtspMediaSource+import androidx.media3.exoplayer.smoothstreaming.SsMediaSourceimport androidx.media3.exoplayer.source.DefaultMediaSourceFactoryimport androidx.media3.exoplayer.source.MediaSourceimport androidx.media3.exoplayer.source.ProgressiveMediaSource@@ -20,7 +22,6 @@ import com.streamvault.domain.model.DrmSchemeimport com.streamvault.domain.model.StreamInfoimport com.streamvault.domain.model.StreamTypeimport java.util.UUID-import androidx.media3.common.C@UnstableApiclass PlayerMediaSourceFactory(@@ -50,6 +51,15 @@ class PlayerMediaSourceFactory(.setLoadErrorHandlingPolicy(retryPolicy).createMediaSource(mediaItem)+ resolvedStreamType == ResolvedStreamType.SMOOTH_STREAMING -> SsMediaSource.Factory(dataSourceFactory)+ .apply {+ if (streamInfo.drmInfo?.scheme == DrmScheme.CLEARKEY) {+ setManifestParser(ClearKeySmoothStreamingManifestParser())+ }+ }+ .setLoadErrorHandlingPolicy(retryPolicy)+ .createMediaSource(mediaItem)+resolvedStreamType == ResolvedStreamType.MPEG_TS_LIVE -> ProgressiveMediaSource.Factory(dataSourceFactory,DefaultExtractorsFactory()@@ -138,4 +148,3 @@ class PlayerMediaSourceFactory()}}-diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.kt b/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.ktindex 8564138f..7d207c8c 100644--- a/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.kt+++ b/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.kt@@ -17,7 +17,10 @@ data class PlaybackRetryContext(val timeoutProfile: PlayerTimeoutProfile) {val isLive: Boolean- get() = resolvedStreamType == ResolvedStreamType.HLS || resolvedStreamType == ResolvedStreamType.MPEG_TS_LIVE || resolvedStreamType == ResolvedStreamType.RTSP+ get() = resolvedStreamType == ResolvedStreamType.HLS ||+ resolvedStreamType == ResolvedStreamType.SMOOTH_STREAMING ||+ resolvedStreamType == ResolvedStreamType.MPEG_TS_LIVE ||+ resolvedStreamType == ResolvedStreamType.RTSP}@UnstableApidiff --git a/player/src/main/java/com/streamvault/player/playback/PlayerTimeoutProfile.kt b/player/src/main/java/com/streamvault/player/playback/PlayerTimeoutProfile.ktindex 5be8e89b..9381c131 100644--- a/player/src/main/java/com/streamvault/player/playback/PlayerTimeoutProfile.kt+++ b/player/src/main/java/com/streamvault/player/playback/PlayerTimeoutProfile.kt@@ -39,6 +39,7 @@ enum class PlayerTimeoutProfile(if (streamInfo.streamType == StreamType.RTSP) return LIVEreturn when {resolvedStreamType == ResolvedStreamType.HLS -> LIVE+ resolvedStreamType == ResolvedStreamType.SMOOTH_STREAMING -> LIVEresolvedStreamType == ResolvedStreamType.MPEG_TS_LIVE -> LIVEresolvedStreamType == ResolvedStreamType.RTSP -> LIVEresolvedStreamType == ResolvedStreamType.PROGRESSIVE -> PROGRESSIVE@@ -48,4 +49,3 @@ enum class PlayerTimeoutProfile(}}}-diff --git a/player/src/main/java/com/streamvault/player/playback/StreamTypeResolver.kt b/player/src/main/java/com/streamvault/player/playback/StreamTypeResolver.ktindex d14d74cd..5e69a38e 100644--- a/player/src/main/java/com/streamvault/player/playback/StreamTypeResolver.kt+++ b/player/src/main/java/com/streamvault/player/playback/StreamTypeResolver.kt@@ -8,6 +8,7 @@ import java.util.Localeenum class ResolvedStreamType {HLS,DASH,+ SMOOTH_STREAMING,PROGRESSIVE,MPEG_TS_LIVE,RTSP,@@ -21,6 +22,7 @@ object StreamTypeResolver {"application/x-mpegurl")private val dashMimeHints = listOf("application/dash+xml")+ private val smoothStreamingMimeHints = listOf("application/vnd.ms-sstr+xml", "text/xml")private val hlsQueryHints = listOf("ext=m3u8", "output=m3u8", "format=m3u8", "type=m3u8")private val tsQueryHints = listOf("ext=ts", "output=ts", "format=ts", "type=ts")private val hlsLiveAliases = setOf("sd", "hd", "fhd", "uhd", "4k", "playlist", "master", "index")@@ -29,6 +31,7 @@ object StreamTypeResolver {return when (streamInfo.streamType) {StreamType.HLS -> ResolvedStreamType.HLSStreamType.DASH -> ResolvedStreamType.DASH+ StreamType.SMOOTH_STREAMING -> ResolvedStreamType.SMOOTH_STREAMINGStreamType.MPEG_TS -> ResolvedStreamType.MPEG_TS_LIVEStreamType.PROGRESSIVE -> ResolvedStreamType.PROGRESSIVEStreamType.RTSP -> ResolvedStreamType.RTSP@@ -56,10 +59,14 @@ object StreamTypeResolver {scheme in setOf("file", "content") -> ResolvedStreamType.PROGRESSIVEnormalizedMimeType != null && hlsMimeHints.any(normalizedMimeType::contains) -> ResolvedStreamType.HLSnormalizedMimeType != null && dashMimeHints.any(normalizedMimeType::contains) -> ResolvedStreamType.DASH+ normalizedMimeType != null && smoothStreamingMimeHints.any(normalizedMimeType::contains) && path.contains(".ism") ->+ ResolvedStreamType.SMOOTH_STREAMINGhlsQueryHints.any(query::contains) -> ResolvedStreamType.HLStsQueryHints.any(query::contains) -> ResolvedStreamType.MPEG_TS_LIVEpath.contains(".m3u8") -> ResolvedStreamType.HLSpath.contains(".mpd") -> ResolvedStreamType.DASH+ path.contains(".isml/manifest") || path.contains(".ism/manifest") || path.endsWith(".ism") || path.endsWith(".isml") ->+ ResolvedStreamType.SMOOTH_STREAMINGpath.endsWith(".ts") -> ResolvedStreamType.MPEG_TS_LIVEisLive && path.contains("/live/") && lastSegment in hlsLiveAliases -> ResolvedStreamType.HLSisLive && path.contains("/live/") && progressiveExtensions.none(path::endsWith) ->@@ -75,4 +82,3 @@ object StreamTypeResolver {streamInfo.catchUpUrl != null}}-diff --git a/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.kt b/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.ktindex de6f5cb8..f13f277a 100644--- a/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.kt+++ b/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.kt@@ -145,6 +145,7 @@ internal class DefaultLiveTimeshiftManager @Inject constructor(val session = when (support.streamType) {StreamType.HLS -> HlsSession(streamInfo, config, backend, sessionDir)StreamType.DASH -> DashSession(streamInfo, config, backend, sessionDir)+ StreamType.SMOOTH_STREAMING,StreamType.MPEG_TS,StreamType.PROGRESSIVE,StreamType.UNKNOWN -> ProgressiveSession(streamInfo, config, backend, sessionDir)@@ -244,6 +245,7 @@ internal class DefaultLiveTimeshiftManager @Inject constructor(val type = inferType(streamInfo)return when (type) {StreamType.RTSP -> SupportResult(false, "RTSP streams cannot use local rewind yet.", type)+ StreamType.SMOOTH_STREAMING -> SupportResult(false, "SmoothStreaming streams cannot use local rewind yet.", type)else -> SupportResult(true, null, type)}}@@ -254,6 +256,8 @@ internal class DefaultLiveTimeshiftManager @Inject constructor(return when {url.endsWith(".m3u8") -> StreamType.HLSurl.endsWith(".mpd") -> StreamType.DASH+ url.contains(".isml/manifest") || url.contains(".ism/manifest") || url.endsWith(".ism") || url.endsWith(".isml") ->+ StreamType.SMOOTH_STREAMINGurl.endsWith(".ts") -> StreamType.MPEG_TSurl.startsWith("rtsp") -> StreamType.RTSPelse -> StreamType.PROGRESSIVEdiff --git a/player/src/main/java/com/streamvault/player/tracks/PlayerTrackController.kt b/player/src/main/java/com/streamvault/player/tracks/PlayerTrackController.ktindex 9c4b574d..028a902e 100644--- a/player/src/main/java/com/streamvault/player/tracks/PlayerTrackController.kt+++ b/player/src/main/java/com/streamvault/player/tracks/PlayerTrackController.kt@@ -51,6 +51,7 @@ class PlayerTrackController(.setTrackTypeDisabled(C.TRACK_TYPE_TEXT, true).setTrackTypeDisabled(C.TRACK_TYPE_VIDEO, false).setPreferredAudioLanguage(preferredAudioLanguageTag)+ .setViewportSizeToPhysicalDisplaySize(context, true).apply {resolvedMaxVideoHeightForCurrentNetwork(constrainResolutionForMultiView)?.let { maxHeight ->setMaxVideoSize(Int.MAX_VALUE, maxHeight)@@ -277,4 +278,3 @@ internal fun normalizeSelectedVideoTrackId(availableTrackIds.size == 1 -> availableTrackIds.first()else -> PLAYER_TRACK_AUTO_ID}-diff --git a/player/src/test/java/com/streamvault/player/playback/StreamTypeResolverTest.kt b/player/src/test/java/com/streamvault/player/playback/StreamTypeResolverTest.ktindex 7232e2b1..3b44421a 100644--- a/player/src/test/java/com/streamvault/player/playback/StreamTypeResolverTest.kt+++ b/player/src/test/java/com/streamvault/player/playback/StreamTypeResolverTest.kt@@ -17,6 +17,12 @@ class StreamTypeResolverTest {.isEqualTo(ResolvedStreamType.DASH)}+ @Test+ fun `isml manifest resolves to SmoothStreaming`() {+ assertThat(StreamTypeResolver.resolve("https://example.com/index.isml/Manifest"))+ .isEqualTo(ResolvedStreamType.SMOOTH_STREAMING)+ }+@Testfun `live url resolves to MPEG TS live`() {assertThat(StreamTypeResolver.resolve("http://example.com/live/channel1", isLive = true))@@ -53,4 +59,3 @@ class StreamTypeResolverTest {.isEqualTo(ResolvedStreamType.UNKNOWN)}}-