From f55b2d892ada18d989978cf138259c0c67385428 Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 27 Dec 2023 17:25:55 -0800 Subject: [PATCH 1/7] Updates for 2.0.0 and components work --- .idea/misc.xml | 1 - .../room/data/DefaultRoomOptions.kt | 2 +- .../livestream/room/data/LivestreamApi.kt | 3 +- .../livestream/room/data/RoomMetadata.kt | 3 +- .../room/screen/ParticipantInfoScreen.kt | 14 +++--- .../room/screen/ParticipantListScreen.kt | 29 ++++++------ .../livestream/room/screen/RoomScreen.kt | 24 +++++----- .../room/screen/StreamOptionsScreen.kt | 3 +- .../room/state/RememberHostParticipant.kt | 2 +- .../room/state/RememberOnStageParticipants.kt | 4 +- .../room/state/RememberRoomMetadata.kt | 8 ++-- .../livestream/room/ui/ParticipantGrid.kt | 44 ++++++++++--------- .../livestream/ui/screen/StartScreen.kt | 3 +- 13 files changed, 74 insertions(+), 66 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 0ad17cb..8978d23 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt index 01a76e2..7c818b6 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt @@ -30,7 +30,7 @@ fun DefaultRoomOptions(customizer: (RoomOptions) -> RoomOptions): RoomOptions { adaptiveStream = true, dynacast = true, videoTrackPublishDefaults = VideoTrackPublishDefaults( - videoEncoding = VideoPreset169.HD.encoding.copy(maxBitrate = 3_000_000), + videoEncoding = VideoPreset169.H720.encoding.copy(maxBitrate = 3_000_000), simulcast = true, ) ) diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt index d0338bd..950b790 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt @@ -16,6 +16,7 @@ package io.livekit.android.sample.livestream.room.data +import io.livekit.android.room.participant.Participant import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import retrofit2.Response @@ -96,5 +97,5 @@ data class ConnectionDetails( @Serializable data class IdentityRequest( - val identity: String + val identity: Participant.Identity ) diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt index bf8dc67..9472ef0 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt @@ -16,6 +16,7 @@ package io.livekit.android.sample.livestream.room.data +import io.livekit.android.room.participant.Participant import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString @@ -24,7 +25,7 @@ import kotlinx.serialization.encodeToString @Serializable data class RoomMetadata( @SerialName("creator_identity") - val creatorIdentity: String, + val creatorIdentity: Participant.Identity, @SerialName("enable_chat") val enableChat: Boolean, @SerialName("allow_participant") diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt index 0dca2b9..51dfc06 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt @@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -34,6 +33,7 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.spec.DestinationStyleBottomSheet import io.livekit.android.compose.local.RoomLocal import io.livekit.android.compose.state.rememberParticipantInfo +import io.livekit.android.room.participant.Participant import io.livekit.android.sample.livestream.room.data.AuthenticatedLivestreamApi import io.livekit.android.sample.livestream.room.data.IdentityRequest import io.livekit.android.sample.livestream.room.state.rememberParticipantMetadata @@ -53,7 +53,7 @@ import kotlinx.coroutines.launch @Destination(style = DestinationStyleBottomSheet::class) @Composable fun ParticipantInfoScreen( - participantSid: String, + participantSid: Participant.Sid, isHost: IsHost, authedApi: AuthenticatedLivestreamApi, coroutineScope: CoroutineScope, @@ -61,7 +61,7 @@ fun ParticipantInfoScreen( ) { val room = RoomLocal.current val participant = remember(room, participantSid) { - room.getParticipant(participantSid) + room.getParticipantBySid(participantSid) } if (participant == null) { @@ -69,7 +69,7 @@ fun ParticipantInfoScreen( return } - val roomMetadata by rememberRoomMetadata() + val roomMetadata = rememberRoomMetadata() val participantInfo = rememberParticipantInfo(participant) val participantMetadata = rememberParticipantMetadata(participant) @@ -90,8 +90,8 @@ fun ParticipantInfoScreen( Spacer(Dimens.spacer) AvatarIcon( - imageUrl = participantMetadata.avatarImageUrlWithFallback(participant.identity ?: ""), - name = participant.identity, + imageUrl = participantMetadata.avatarImageUrlWithFallback(participant.identity?.value ?: ""), + name = participant.identity?.value ?: "", modifier = Modifier .size(108.dp) .align(Alignment.CenterHorizontally) @@ -100,7 +100,7 @@ fun ParticipantInfoScreen( Spacer(8.dp) Text( - text = participantInfo.identity ?: "", + text = participantInfo.identity?.value ?: "", fontWeight = FontWeight.W700, fontSize = 14.sp, ) diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt index de79d45..4031823 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt @@ -29,7 +29,6 @@ import androidx.compose.foundation.lazy.LazyItemScope import androidx.compose.foundation.lazy.items import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -39,7 +38,6 @@ import androidx.compose.ui.unit.dp import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.spec.DestinationStyleBottomSheet -import io.livekit.android.compose.state.rememberParticipants import io.livekit.android.sample.livestream.destinations.ParticipantInfoScreenDestination import io.livekit.android.sample.livestream.room.data.AuthenticatedLivestreamApi import io.livekit.android.sample.livestream.room.data.IdentityRequest @@ -85,8 +83,7 @@ fun ParticipantListScreen( HorizontalLine() Spacer(Dimens.spacer) - val roomMetadata by rememberRoomMetadata() - val participants = rememberParticipants() + val roomMetadata = rememberRoomMetadata() val metadatas = rememberParticipantMetadatas() val hostParticipant = rememberHostParticipant(roomMetadata.creatorIdentity) @@ -94,7 +91,7 @@ fun ParticipantListScreen( .filter { (participant, metadata) -> metadata.isOnStage || participant == hostParticipant } .entries .toList() - .sortedBy { it.key.identity ?: "" } + .sortedBy { it.key.identity?.value ?: "" } // Only visible to the host. val requestsToJoin = if (isHost.value) { @@ -102,7 +99,7 @@ fun ParticipantListScreen( .filter { (participant, metadata) -> metadata.handRaised && !metadata.invitedToStage && !hosts.any { it.key == participant } } .entries .toList() - .sortedBy { it.key.identity ?: "" } + .sortedBy { it.key.identity?.value ?: "" } } else { emptyList() } @@ -112,7 +109,7 @@ fun ParticipantListScreen( .filter { p -> !hosts.any { it == p } } .entries .toList() - .sortedBy { it.key.identity ?: "" } + .sortedBy { it.key.identity?.value ?: "" } LazyColumn { if (requestsToJoin.isNotEmpty()) { @@ -130,14 +127,16 @@ fun ParticipantListScreen( key = { it.key.sid } ) { (participant, metadata) -> ParticipantRow( - name = participant.identity ?: "", - imageUrl = metadata.avatarImageUrlWithFallback(participant.identity ?: ""), + name = participant.identity?.value ?: "", + imageUrl = metadata.avatarImageUrlWithFallback(participant.identity?.value ?: ""), isRequestingToJoin = true, onAllowClick = { - authedApi.inviteToStage(IdentityRequest(participant.identity ?: "")) + val identity = participant.identity ?: return@ParticipantRow + authedApi.inviteToStage(IdentityRequest(identity)) }, onDenyClick = { - authedApi.removeFromStage(IdentityRequest(participant.identity ?: "")) + val identity = participant.identity ?: return@ParticipantRow + authedApi.removeFromStage(IdentityRequest(identity)) }, modifier = Modifier .clickable { navigator.navigate(ParticipantInfoScreenDestination(participant.sid)) } @@ -161,8 +160,8 @@ fun ParticipantListScreen( key = { it.key.sid } ) { (participant, metadata) -> ParticipantRow( - name = participant.identity ?: "", - imageUrl = metadata.avatarImageUrlWithFallback(participant.identity ?: ""), + name = participant.identity?.value ?: "", + imageUrl = metadata.avatarImageUrlWithFallback(participant.identity?.value ?: ""), modifier = Modifier .clickable { navigator.navigate(ParticipantInfoScreenDestination(participant.sid)) } .animateItemPlacement() @@ -185,8 +184,8 @@ fun ParticipantListScreen( key = { it.key.sid } ) { (participant, metadata) -> ParticipantRow( - name = participant.identity ?: "", - imageUrl = metadata.avatarImageUrlWithFallback(participant.identity ?: ""), + name = participant.identity?.value ?: "", + imageUrl = metadata.avatarImageUrlWithFallback(participant.identity?.value ?: ""), modifier = Modifier .clickable { navigator.navigate(ParticipantInfoScreenDestination(participant.sid)) } .animateItemPlacement() diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt index eb54eb5..82e1251 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt @@ -51,9 +51,8 @@ import io.livekit.android.compose.chat.rememberChat import io.livekit.android.compose.local.HandleRoomState import io.livekit.android.compose.local.RoomLocal import io.livekit.android.compose.local.RoomScope -import io.livekit.android.compose.local.rememberVideoTrack -import io.livekit.android.compose.local.rememberVideoTrackPublication import io.livekit.android.compose.state.rememberParticipants +import io.livekit.android.compose.state.rememberTracks import io.livekit.android.compose.ui.flipped import io.livekit.android.room.Room import io.livekit.android.room.RoomException @@ -262,8 +261,8 @@ fun RoomScreen( showOptionsDialogOnce: MutableState, isHost: IsHost, ) { - val roomMetadata by rememberRoomMetadata() - val chat by rememberChat() + val roomMetadata = rememberRoomMetadata() + val chat = rememberChat() val scope = rememberCoroutineScope() if (showOptionsDialogOnce.value) { @@ -279,11 +278,16 @@ fun RoomScreen( ) { val (chatLog, chatBar, hostScreen, viewerButton) = createRefs() + val tracks = rememberTracks(usePlaceholders = setOf(Track.Source.CAMERA)) val hostParticipant = rememberHostParticipant(roomMetadata.creatorIdentity) - val videoParticipants = rememberOnStageParticipants(roomMetadata.creatorIdentity) - val participants = listOf(hostParticipant).plus(videoParticipants) - val videoTrackPublications = participants.map { rememberVideoTrackPublication(participant = it) } - val videoTracks = videoTrackPublications.map { rememberVideoTrack(videoPub = it) } + val hostTrack = tracks.firstOrNull { track -> track.participant == hostParticipant } + + val stageParticipants = rememberOnStageParticipants(roomMetadata.creatorIdentity) + val stageTracks = stageParticipants.map { p -> + tracks.firstOrNull { track -> track.participant == p } + } + + val videoTracks = listOf(hostTrack).plus(stageTracks) val metadatas = rememberParticipantMetadatas() val hasRaisedHands = if (isHost.value) { @@ -319,9 +323,9 @@ fun RoomScreen( messages = chat.messages.value.mapNotNull { val participantMetadata = metadatas[it.participant] ?: return@mapNotNull null ChatWidgetMessage( - it.participant?.identity ?: "", + it.participant?.identity?.value ?: "", it.message, - participantMetadata.avatarImageUrlWithFallback(it.participant?.identity ?: ""), + participantMetadata.avatarImageUrlWithFallback(it.participant?.identity?.value ?: ""), it.timestamp, ) }, diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt index 0fcfaa2..a7bd7b6 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt @@ -29,7 +29,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -72,7 +71,7 @@ fun StreamOptionsScreen( ) { val room = RoomLocal.current val roomInfo = rememberRoomInfo() - val roomMetadata by rememberRoomMetadata() + val roomMetadata = rememberRoomMetadata() val localParticipant = room.localParticipant val metadata = rememberParticipantMetadata(participant = localParticipant) diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt index 91d481e..6ac2bdf 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt @@ -27,7 +27,7 @@ import io.livekit.android.room.participant.Participant * Finds the creator of the room. */ @Composable -fun rememberHostParticipant(identity: String): Participant? { +fun rememberHostParticipant(identity: Participant.Identity): Participant? { val participantInfos = rememberParticipants().associateWith { rememberParticipantInfo(it) } val hostParticipant = remember(participantInfos) { diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt index 569069f..ceb8c90 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt @@ -26,7 +26,7 @@ import io.livekit.android.sample.livestream.room.data.ParticipantMetadata * Finds all onstage participants. */ @Composable -fun rememberOnStageParticipants(hostIdentity: String): List { +fun rememberOnStageParticipants(hostIdentity: Participant.Identity): List { val metadatas = rememberParticipantMetadatas() return remember(metadatas) { @@ -34,7 +34,7 @@ fun rememberOnStageParticipants(hostIdentity: String): List { return@derivedStateOf metadatas .filter { (participant, metadata) -> metadata.isOnStage && participant.identity != hostIdentity } .keys - .sortedBy { it.identity ?: "" } + .sortedBy { it.identity?.value ?: "" } } }.value } diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt index dff740f..051cdef 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt @@ -17,11 +17,11 @@ package io.livekit.android.sample.livestream.room.state import androidx.compose.runtime.Composable -import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.remember import io.livekit.android.compose.local.RoomLocal +import io.livekit.android.room.participant.Participant import io.livekit.android.sample.livestream.room.data.ParticipantMetadata import io.livekit.android.sample.livestream.room.data.RoomMetadata import io.livekit.android.util.flow @@ -30,7 +30,7 @@ import io.livekit.android.util.flow * Parses the room's metadata as [ParticipantMetadata]. */ @Composable -fun rememberRoomMetadata(): State { +fun rememberRoomMetadata(): RoomMetadata { val room = RoomLocal.current val metadataState = room::metadata.flow .collectAsState() @@ -42,12 +42,12 @@ fun rememberRoomMetadata(): State { RoomMetadata.fromJson(metadata) } ?: RoomMetadata( - creatorIdentity = "", + creatorIdentity = Participant.Identity(""), enableChat = false, allowParticipation = false ) } } - return metadata + return metadata.value } diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt index f864268..220d202 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt @@ -36,9 +36,9 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import io.livekit.android.compose.local.RoomLocal +import io.livekit.android.compose.types.TrackReference import io.livekit.android.compose.ui.ScaleType -import io.livekit.android.compose.ui.VideoRenderer -import io.livekit.android.room.track.VideoTrack +import io.livekit.android.compose.ui.VideoTrackView import io.livekit.android.sample.livestream.R import io.livekit.android.sample.livestream.ui.control.Spacer import io.livekit.android.sample.livestream.ui.theme.NoVideoBackground @@ -47,7 +47,7 @@ import io.livekit.android.sample.livestream.ui.theme.NoVideoBackground * A video grid that adapts to layouts required for 1-N participants. */ @Composable -fun ParticipantGrid(videoTracks: List, isHost: Boolean, modifier: Modifier = Modifier) { +fun ParticipantGrid(videoTracks: List, isHost: Boolean, modifier: Modifier = Modifier) { when (videoTracks.size) { 0 -> Box(modifier = modifier) 1 -> SingleArrangement(videoTrack = videoTracks[0], isHost = isHost, modifier = modifier) @@ -58,21 +58,21 @@ fun ParticipantGrid(videoTracks: List, isHost: Boolean, modifier: M } @Composable -private fun SingleArrangement(videoTrack: VideoTrack?, isHost: Boolean, modifier: Modifier) { +private fun SingleArrangement(videoTrack: TrackReference?, isHost: Boolean, modifier: Modifier) { // Full screen VideoItem( - videoTrack = videoTrack, + trackReference = videoTrack, isHost = isHost, modifier = modifier ) } @Composable -private fun TwoArrangement(videoTracks: List, isHost: Boolean, modifier: Modifier) { +private fun TwoArrangement(videoTracks: List, isHost: Boolean, modifier: Modifier) { // Vertically two stacked. Column(modifier = modifier) { VideoItem( - videoTrack = videoTracks[0], + trackReference = videoTracks[0], isHost = isHost, modifier = Modifier .fillMaxWidth() @@ -82,7 +82,7 @@ private fun TwoArrangement(videoTracks: List, isHost: Boolean, modi Spacer(8.dp) VideoItem( - videoTrack = videoTracks[1], + trackReference = videoTracks[1], modifier = Modifier .fillMaxWidth() .weight(1f) @@ -91,7 +91,7 @@ private fun TwoArrangement(videoTracks: List, isHost: Boolean, modi } @Composable -private fun ThreeOrFourArrangement(videoTracks: List, isHost: Boolean, modifier: Modifier) { +private fun ThreeOrFourArrangement(videoTracks: List, isHost: Boolean, modifier: Modifier) { Column(modifier = modifier) { Row( modifier = Modifier @@ -99,7 +99,7 @@ private fun ThreeOrFourArrangement(videoTracks: List, isHost: Boole .weight(1f) ) { VideoItem( - videoTrack = videoTracks[0], + trackReference = videoTracks[0], isHost = isHost, modifier = Modifier .fillMaxHeight() @@ -109,7 +109,7 @@ private fun ThreeOrFourArrangement(videoTracks: List, isHost: Boole Spacer(8.dp) VideoItem( - videoTrack = videoTracks[1], + trackReference = videoTracks[1], modifier = Modifier .fillMaxHeight() .weight(1f) @@ -124,7 +124,7 @@ private fun ThreeOrFourArrangement(videoTracks: List, isHost: Boole .weight(1f) ) { VideoItem( - videoTrack = videoTracks[2], + trackReference = videoTracks[2], modifier = Modifier .fillMaxHeight() .weight(1f) @@ -134,7 +134,7 @@ private fun ThreeOrFourArrangement(videoTracks: List, isHost: Boole if (videoTracks.size > 3) { VideoItem( - videoTrack = videoTracks[3], + trackReference = videoTracks[3], modifier = Modifier .fillMaxHeight() .weight(1f) @@ -151,7 +151,7 @@ private fun ThreeOrFourArrangement(videoTracks: List, isHost: Boole } @Composable -private fun ManyArrangement(videoTracks: List, isHost: Boolean, modifier: Modifier) { +private fun ManyArrangement(videoTracks: List, isHost: Boolean, modifier: Modifier) { LazyVerticalGrid( columns = GridCells.Fixed(2), verticalArrangement = Arrangement.spacedBy(8.dp), @@ -160,7 +160,7 @@ private fun ManyArrangement(videoTracks: List, isHost: Boolean, mod ) { items(videoTracks.size) { index -> VideoItem( - videoTrack = videoTracks[index], + trackReference = videoTracks[index], isHost = index == 0 && isHost, modifier = Modifier.height(240.dp) ) @@ -169,14 +169,18 @@ private fun ManyArrangement(videoTracks: List, isHost: Boolean, mod } @Composable -fun VideoItem(videoTrack: VideoTrack?, modifier: Modifier = Modifier, isHost: Boolean = false) { - if (videoTrack == null) { +fun VideoItem(trackReference: TrackReference?, modifier: Modifier = Modifier, isHost: Boolean = false) { + if (trackReference == null || !trackReference.isSubscribed()) { Box( contentAlignment = Alignment.Center, modifier = modifier .clip(RoundedCornerShape(8.dp)) ) { - Box(modifier = Modifier.background(NoVideoBackground).fillMaxSize()) + Box( + modifier = Modifier + .background(NoVideoBackground) + .fillMaxSize() + ) Image( painter = painterResource(id = R.drawable.outline_videocam_off_24), contentDescription = "", @@ -184,9 +188,9 @@ fun VideoItem(videoTrack: VideoTrack?, modifier: Modifier = Modifier, isHost: Bo ) } } else { - VideoRenderer( + VideoTrackView( room = RoomLocal.current, - videoTrack = videoTrack, + trackReference = trackReference, mirror = isHost, scaleType = ScaleType.Fill, modifier = Modifier diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt index b33a4bb..d43eeda 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt @@ -59,6 +59,7 @@ import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import io.livekit.android.compose.ui.CameraPreview import io.livekit.android.compose.ui.flipped +import io.livekit.android.room.participant.Participant import io.livekit.android.room.track.CameraPosition import io.livekit.android.sample.livestream.destinations.RoomScreenContainerDestination import io.livekit.android.sample.livestream.room.data.CreateStreamRequest @@ -224,7 +225,7 @@ fun StartScreen( response = livestreamApi.createStream( CreateStreamRequest( metadata = RoomMetadata( - creatorIdentity = userName.text, + creatorIdentity = Participant.Identity(userName.text), enableChat = chatEnabled, allowParticipation = viewerJoinRequestEnabled, ) From eeccee1b5d923cdeb74ca6caddb6618b1d44c84d Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 27 Dec 2023 17:32:13 -0800 Subject: [PATCH 2/7] spotless --- .editorconfig | 39 ++++++++ LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++ LicenseHeaderFile.txt | 16 ++++ build.gradle | 40 ++++++++- 4 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 .editorconfig create mode 100644 LICENSE create mode 100644 LicenseHeaderFile.txt diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0634ba0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,39 @@ +# https://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +max_line_length = 180 + +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{java,kt,kts,scala,rs,xml,kt.spec,kts.spec,gradle,md}] +indent_size = 4 + +[*.{kt,kts}] +ktlint_code_style = android_studio + +# default IntelliJ IDEA style, same as alphabetical, but with "java", "javax", "kotlin" and alias imports in the end of the imports list +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ + +ktlint_standard = enabled +ktlint_standard_annotation = disabled +ktlint_standard_no-wildcard-imports = disabled + +ktlint_standard_trailing-comma-on-call-site = disabled +ij_kotlin_allow_trailing_comma_on_call_site = true +ktlint_standard_trailing-comma-on-declaration-site = disabled +ij_kotlin_allow_trailing_comma = true + +ktlint_standard_wrapping = disabled + +[*.md] +trim_trailing_whitespace = false +max_line_length = unset + +[*.yml] +ij_yaml_spaces_within_brackets = false diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + 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. \ No newline at end of file diff --git a/LicenseHeaderFile.txt b/LicenseHeaderFile.txt new file mode 100644 index 0000000..e4747d1 --- /dev/null +++ b/LicenseHeaderFile.txt @@ -0,0 +1,16 @@ +/* + * Copyright $YEAR LiveKit, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + diff --git a/build.gradle b/build.gradle index a03ac89..4ad9d7d 100644 --- a/build.gradle +++ b/build.gradle @@ -14,4 +14,42 @@ plugins { id 'org.jetbrains.kotlin.android' version '1.8.0' apply false id 'com.google.devtools.ksp' version '1.8.20-1.0.10' apply false id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version" apply false -} \ No newline at end of file + id 'com.diffplug.gradle.spotless' version "6.23.3" apply false +} + +subprojects { + apply plugin: "com.diffplug.spotless" + spotless { + // optional: limit format enforcement to just the files changed by this feature branch + ratchetFrom 'origin/main' + + format 'misc', { + // define the files to apply `misc` to + target '*.gradle', '*.md', '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() + endWithNewline() + } + java { + // apply a specific flavor of google-java-format + googleJavaFormat('1.17.0').aosp().reflowLongStrings() + // fix formatting of type annotations + formatAnnotations() + // make sure every file has the following copyright header. + // optionally, Spotless can set copyright years by digging + // through git history (see "license" section below) + licenseHeaderFile rootProject.file("LicenseHeaderFile.txt") + removeUnusedImports() + } + kotlin { + target("src/*/java/**/*.kt") + ktlint("0.50.0") + .setEditorConfigPath("$rootDir/.editorconfig") + licenseHeaderFile(rootProject.file("LicenseHeaderFile.txt")) + .named('license') + endWithNewline() + } + } +} From 40cd0446a60cd053df0a31058cbaf493f518e840 Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 10 Jan 2024 20:19:23 +0900 Subject: [PATCH 3/7] Add in CI --- .github/ISSUE_TEMPLATE/bug_report.md | 32 +++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++ .github/workflows/README.md | 1 + .github/workflows/android.yml | 58 +++++++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/android.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..82068d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Device Info:** + - Device: [e.g. Google Pixel 4] + - OS: [e.g. Android 12] + - LiveKit SDK version: [e.g. 1.0.0] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..4c06103 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: davidliu + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..36faba7 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1 @@ +Use https://github.com/nektos/act to test github actions locally. diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..dd070a7 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,58 @@ +name: Android CI + +on: + push: + branches: [ main ] + paths-ignore: + - '**.md' + - 'LICENSE' + - 'NOTICE' + - '.gitignore' + pull_request: + branches: [ main ] + paths-ignore: + - '**.md' + - 'LICENSE' + - 'NOTICE' + - '.gitignore' + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./android-livestream + steps: + - name: checkout android-livestream + uses: actions/checkout@v4.0.0 + with: + path: ./android-livestream + submodules: recursive + + - name: set up JDK 17 + uses: actions/setup-java@v3.12.0 + with: + java-version: '17' + distribution: 'adopt' + + - uses: actions/cache@v3.3.2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Gradle clean + run: ./gradlew clean + + - name: Spotless check + if: github.event_name == 'pull_request' + run: | + git fetch origin main --depth 1 + ./gradlew spotlessCheck + + - name: Build with Gradle + run: ./gradlew assembleRelease livekit-android-sdk:testRelease From 5a01b16f03d26ad60045cc14aa4c9323dfdd22e0 Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 10 Jan 2024 20:21:48 +0900 Subject: [PATCH 4/7] spotless --- .idea/inspectionProfiles/Project_Default.xml | 41 +++++++++++++++++++ .../room/data/DefaultRoomOptions.kt | 2 +- .../livestream/room/data/LivestreamApi.kt | 2 +- .../livestream/room/data/RoomMetadata.kt | 2 +- .../room/screen/ParticipantInfoScreen.kt | 2 +- .../room/screen/ParticipantListScreen.kt | 2 +- .../livestream/room/screen/RoomScreen.kt | 2 +- .../room/screen/StreamOptionsScreen.kt | 2 +- .../room/state/RememberHostParticipant.kt | 2 +- .../room/state/RememberOnStageParticipants.kt | 2 +- .../room/state/RememberRoomMetadata.kt | 2 +- .../livestream/room/ui/ParticipantGrid.kt | 2 +- .../livestream/ui/screen/StartScreen.kt | 2 +- 13 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..44ca2d9 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,41 @@ + + + + \ No newline at end of file diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt index 7c818b6..759b107 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/DefaultRoomOptions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt index 950b790..4de872b 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/LivestreamApi.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt index 9472ef0..bb49e19 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/data/RoomMetadata.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt index 51dfc06..5f0f40e 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantInfoScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt index 4031823..f5ffff6 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/ParticipantListScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt index 82e1251..d73d44f 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt index a7bd7b6..a7ae05b 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/StreamOptionsScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt index 6ac2bdf..d640a8c 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberHostParticipant.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt index ceb8c90..a8dd540 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberOnStageParticipants.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt index 051cdef..0608b73 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/state/RememberRoomMetadata.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt index 220d202..78daca2 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/ui/ParticipantGrid.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt index d43eeda..ceea0e1 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/ui/screen/StartScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 LiveKit, Inc. + * Copyright 2023-2024 LiveKit, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 2ce0769def5c5cc15ec2925d1769a1b9ab297685 Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 10 Jan 2024 20:27:08 +0900 Subject: [PATCH 5/7] Spotless --- .../livekit/android/sample/livestream/room/screen/RoomScreen.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt index d73d44f..2994df1 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt @@ -86,7 +86,6 @@ import io.livekit.android.sample.livestream.room.ui.ConfettiState import io.livekit.android.sample.livestream.room.ui.ParticipantGrid import io.livekit.android.sample.livestream.room.ui.RoomConfettiView import io.livekit.android.sample.livestream.room.ui.RoomControls -import io.livekit.android.sample.livestream.room.ui.isOneEmoji import io.livekit.android.sample.livestream.ui.control.LoadingDialog import io.livekit.android.sample.livestream.util.KeepScreenOn import io.livekit.android.util.flow From 5e0ff3c226a53c8c5f9d70b3808bbd25d2e8e9fd Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 10 Jan 2024 20:49:36 +0900 Subject: [PATCH 6/7] Use specific snapshot version for now --- sample-livestream/build.gradle | 2 +- .../livekit/android/sample/livestream/room/screen/RoomScreen.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sample-livestream/build.gradle b/sample-livestream/build.gradle index f6c3bb1..802b735 100644 --- a/sample-livestream/build.gradle +++ b/sample-livestream/build.gradle @@ -52,7 +52,7 @@ def coil_version = "2.4.0" dependencies { - implementation "io.livekit:livekit-android-compose-components:0.0.1-SNAPSHOT" + implementation "io.livekit:livekit-android-compose-components:0.0.1-20240110.112307-8" implementation "com.github.ajalt:timberkt:1.5.1" implementation "com.squareup.retrofit2:retrofit:2.9.0" implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0") diff --git a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt index 2994df1..8cdc9b0 100644 --- a/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt +++ b/sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/screen/RoomScreen.kt @@ -110,6 +110,7 @@ data class IsHost(val value: Boolean) /** * A container for [RoomScreen] that sets up the needed nav host and dependencies. */ +@OptIn(ExperimentalMaterialNavigationApi::class) @Destination @Composable fun RoomScreenContainer( From 263ec8a71474a7cbbf03e479dce27c9529296b22 Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 10 Jan 2024 20:55:32 +0900 Subject: [PATCH 7/7] fix ci --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index dd070a7..03284c8 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -55,4 +55,4 @@ jobs: ./gradlew spotlessCheck - name: Build with Gradle - run: ./gradlew assembleRelease livekit-android-sdk:testRelease + run: ./gradlew assembleRelease testRelease