Repository navigation
Play HLS livestreams through an opt-in stream-video-android-hls module #1909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PratimMallick
wants to merge
11
commits into
pratimmallick/vid-1543-hls-join-sdk
Choose a base branch
from
pratimmallick/vid-1543-hls-renderer
base: pratimmallick/vid-1543-hls-join-sdk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5a27e0f
feat(compose): play an HLS grant in HlsVideoRenderer
PratimMallick 55df870
fix(compose): acquire the HLS player in an effect and inject the store
PratimMallick 565093f
fix(compose): mute HLS playback from the livestream audio toggle
PratimMallick 724ac2b
Merge remote-tracking branch 'origin/pratimmallick/vid-1543-hls-join-…
PratimMallick 836e8a0
Merge remote-tracking branch 'origin/pratimmallick/vid-1543-hls-join-…
PratimMallick 5031fa7
feat(hls): move ExoPlayer playback and renderer into an opt-in module
PratimMallick d40fdff
refactor(hls): leave resume position to ExoPlayer defaults
PratimMallick b9a707f
Merge branch 'pratimmallick/vid-1543-hls-join-sdk' into pratimmallick…
PratimMallick 1d355da
feat(hls): keep playing while no renderer is shown, like WebRTC
PratimMallick d574598
Merge branch 'pratimmallick/vid-1543-hls-join-sdk' into pratimmallick…
PratimMallick 58d7f4f
feat(demo): show the livestream overlay on the HLS viewer screen
PratimMallick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
demo-app/src/main/kotlin/io/getstream/video/android/ui/call/DemoHlsViewerScreen.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 /> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.