Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ dependencies {
implementation(project(":stream-video-android-ui-compose"))
implementation(project(":stream-video-android-ui-xml"))
implementation(project(":stream-video-android-filters-video"))
implementation(project(":stream-video-android-hls"))
compileOnly(project(":stream-video-android-previewdata"))

implementation(libs.androidx.media.media)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import io.getstream.chat.android.client.ChatClient
import io.getstream.chat.android.models.Filters
import io.getstream.chat.android.models.querysort.QuerySortByField
Expand All @@ -42,9 +43,11 @@ import io.getstream.video.android.core.StreamVideo
import io.getstream.video.android.core.call.state.CallAction
import io.getstream.video.android.core.e2ee.E2EEEventType
import io.getstream.video.android.core.e2ee.StreamEncryptionManager
import io.getstream.video.android.core.model.PlaybackType
import io.getstream.video.android.datastore.delegate.StreamUserDataStore
import io.getstream.video.android.ui.call.CallScreen
import io.getstream.video.android.ui.call.DemoComponentFactory
import io.getstream.video.android.ui.call.DemoHlsViewerScreen
import io.getstream.video.android.ui.common.StreamActivityUiDelegate
import io.getstream.video.android.ui.common.StreamCallActivity
import io.getstream.video.android.ui.common.StreamCallActivityConfiguration
Expand Down Expand Up @@ -83,7 +86,7 @@ class CallActivity : ComposeStreamCallActivity() {
private const val E2EE_TAG = "CallActivityE2EE"
}

override val uiDelegate: StreamActivityUiDelegate<StreamCallActivity> = StreamDemoUiDelegate()
override val uiDelegate: StreamActivityUiDelegate<StreamCallActivity> = DemoHlsUiDelegate()
var observeCallReadyToJoinJob: Job? = null
var observeRingingJob: Job? = null
private val previousRingingStates = ConcurrentHashMap.newKeySet<RingingState>()
Expand Down Expand Up @@ -233,7 +236,35 @@ class CallActivity : ComposeStreamCallActivity() {
DemoE2eeKeys.remember(call.cid, passphrase, manager)
}

private class StreamDemoUiDelegate : StreamCallActivityComposeDelegate() {
/**
* Shows [DemoHlsViewerScreen] when the call was joined as an HLS viewer, and the regular demo
* UI otherwise.
*/
private class DemoHlsUiDelegate : StreamDemoUiDelegate() {

// Kotlin 1.9 cannot call super on a member extension, so the default root comes from a
// delegate that does not override it.
private val webRtcDelegate = StreamDemoUiDelegate()

@StreamCallActivityDelicateApi
@Composable
override fun StreamCallActivity.RootContent(call: Call) {
val playbackType by call.state.playbackType.collectAsStateWithLifecycle()
if (playbackType is PlaybackType.Hls) {
DemoHlsViewerScreen(
call = call,
onLeave = {
leave(call)
safeFinish()
},
)
} else {
with(webRtcDelegate) { RootContent(call) }
}
}
}

private open class StreamDemoUiDelegate : StreamCallActivityComposeDelegate() {

override val componentFactory = DemoComponentFactory

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.getstream.video.android.ui.call

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import io.getstream.video.android.compose.ui.components.call.controls.actions.LeaveCallAction
import io.getstream.video.android.compose.ui.components.livestream.LivestreamPlayerOverlay
import io.getstream.video.android.core.Call
import io.getstream.video.android.hls.HlsVideoRenderer

/**
* The viewer screen for a call the backend serves as HLS: the broadcast under the same overlay as
* the WebRTC livestream player (live badge, participant count, duration and a mute toggle), plus a
* leave button.
*/
@Composable
fun DemoHlsViewerScreen(
call: Call,
onLeave: () -> Unit,
) {
var audioEnabled by rememberSaveable { mutableStateOf(true) }
Box(modifier = Modifier.fillMaxSize()) {
HlsVideoRenderer(
call = call,
modifier = Modifier.fillMaxSize(),
audioEnabled = audioEnabled,
)
Box(
modifier = Modifier
.fillMaxSize()
.safeDrawingPadding(),
) {
LivestreamPlayerOverlay(
call = call,
isAudioEnabled = audioEnabled,
onAudioToggle = { audioEnabled = it },
)
LeaveCallAction(
modifier = Modifier
.align(Alignment.TopEnd)
.padding(12.dp)
.size(45.dp),
) { onLeave() }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import io.getstream.video.android.core.sounds.enableRingingCallVibrationConfig
import io.getstream.video.android.data.services.stream.GetAuthDataResponse
import io.getstream.video.android.data.services.stream.StreamService
import io.getstream.video.android.datastore.delegate.StreamUserDataStore
import io.getstream.video.android.hls.ExoHlsPlayerFactory
import io.getstream.video.android.model.ApiKey
import io.getstream.video.android.model.StreamCallId
import io.getstream.video.android.model.User
Expand Down Expand Up @@ -506,6 +507,7 @@ object StreamVideoInitHelper {
telecomConfig = TelecomConfig(context.packageName),
connectOnInit = false,
rejectCallWhenBusy = false,
hlsPlayerFactory = ExoHlsPlayerFactory(),
).apply {
sfuId?.takeIf { it.isNotBlank() }?.let(::forceSfuId)
}.build()
Expand Down
5 changes: 5 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ androidxUiAutomator = "2.4.0-alpha01"
androidxContraintLayout = "2.1.4"
androidxEspresso = "3.5.1"
androidxMedia = "1.7.0"
# Same version stream-chat-android 7.13 depends on, so an app using both resolves one Media3.
media3 = "1.6.1"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
paparazzi = "1.3.4"
robolectric = "4.11.1"
junit = "4.13.2"
Expand Down Expand Up @@ -177,6 +179,9 @@ stream-chat-offline = { group = "io.getstream", name = "stream-chat-android-offl
stream-chat-state = { group = "io.getstream", name = "stream-chat-android-state", version.ref = "streamChat" }
stream-chat-ui-utils = { group = "io.getstream", name = "stream-chat-android-ui-utils", version.ref = "streamChat" }

media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" }
media3-exoplayer-hls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "media3" }

kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlinTestJunit" }

kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
Expand Down
1 change: 1 addition & 0 deletions scripts/release/local-release
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ modules=(
"stream-video-android-ui-core"
"stream-video-android-ui-compose"
"stream-video-android-filters-video"
"stream-video-android-hls"
"stream-video-android-ui-xml"
)

Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ include(":stream-video-android-ui-core")
include(":stream-video-android-ui-xml")
include(":stream-video-android-ui-compose")
include(":stream-video-android-filters-video")
include(":stream-video-android-hls")
include(":stream-video-android-previewdata")
include(":stream-video-android-bom")

Expand Down
1 change: 1 addition & 0 deletions stream-video-android-bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
api(project(":stream-video-android-ui-xml"))
api(project(":stream-video-android-ui-compose"))
api(project(":stream-video-android-filters-video"))
api(project(":stream-video-android-hls"))
api(project(":stream-video-android-previewdata"))
}
}
10 changes: 10 additions & 0 deletions stream-video-android-hls/api/stream-video-android-hls.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public final class io/getstream/video/android/hls/ExoHlsPlayerFactory : io/getstream/video/android/core/call/hls/HlsPlayerFactory {
public static final field $stable I
public fun <init> ()V
public fun create (Landroid/content/Context;Ljava/lang/String;)Lio/getstream/video/android/core/call/hls/HlsPlayer;
}

public final class io/getstream/video/android/hls/HlsVideoRendererKt {
public static final fun HlsVideoRenderer (Lio/getstream/video/android/core/Call;Landroidx/compose/ui/Modifier;ZLandroidx/compose/runtime/Composer;II)V
}

60 changes: 60 additions & 0 deletions stream-video-android-hls/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id("io.getstream.video.android.library.compose")
}

android {
namespace = "io.getstream.video.android.hls"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
}

testOptions {
unitTests.isIncludeAndroidResources = true
unitTests.isReturnDefaultValues = true
}
}

baselineProfile {
baselineProfileOutputDir = "."
filter {
include("io.getstream.video.android.hls.**")
}
}

dependencies {
api(project(":stream-video-android-core"))

// ExoPlayer only; the renderer supplies the surface, so media3-ui is not needed.
// Version matches stream-chat-android 7.13 so an app using both gets a single Media3.
implementation(libs.media3.exoplayer)
implementation(libs.media3.exoplayer.hls)

implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.runtime)
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.lifecycle.runtime.compose)

testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(libs.mockk)
testImplementation(libs.robolectric)
testImplementation(libs.androidx.activity.compose)
}
17 changes: 17 additions & 0 deletions stream-video-android-hls/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.

Licensed under the Stream License;
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://github.com/GetStream/stream-video-android/blob/main/LICENSE

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest />
Loading
Loading