diff --git a/sample/composeApp/src/commonMain/kotlin/App.kt b/sample/composeApp/src/commonMain/kotlin/App.kt index 7e91ba18..424940ba 100644 --- a/sample/composeApp/src/commonMain/kotlin/App.kt +++ b/sample/composeApp/src/commonMain/kotlin/App.kt @@ -57,17 +57,30 @@ fun App() { Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { val localVideoTrack = localStream?.videoTracks?.firstOrNull() - localVideoTrack?.let { Video(videoTrack = it, modifier = Modifier.weight(1f)) } - ?: Box(modifier = Modifier.weight(1f)) + localVideoTrack?.let { + Video( + videoTrack = it, + modifier = Modifier.weight(1f).fillMaxWidth() + ) + } ?: Box( + modifier = Modifier.weight(1f).fillMaxWidth(), + contentAlignment = Alignment.Center, + ) { + Text("Local video") + } remoteVideoTrack?.let { Video( videoTrack = it, audioTrack = remoteAudioTrack, - modifier = Modifier.weight(1f), + modifier = Modifier.weight(1f).fillMaxWidth(), ) + } ?: Box( + modifier = Modifier.weight(1f).fillMaxWidth(), + contentAlignment = Alignment.Center, + ) { + Text("Remote video") } - ?: Box(modifier = Modifier.weight(1f)) Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { if (localStream == null) { diff --git a/sample/composeApp/src/iosMain/kotlin/Video.ios.kt b/sample/composeApp/src/iosMain/kotlin/Video.ios.kt index fcd1be18..2f6ebad1 100644 --- a/sample/composeApp/src/iosMain/kotlin/Video.ios.kt +++ b/sample/composeApp/src/iosMain/kotlin/Video.ios.kt @@ -13,10 +13,11 @@ actual fun Video(videoTrack: VideoStreamTrack, modifier: Modifier, audioTrack: A UIKitView( factory = { RTCMTLVideoView().apply { - contentMode = UIViewContentMode.UIViewContentModeScaleAspectFit + videoContentMode = UIViewContentMode.UIViewContentModeScaleAspectFit videoTrack.addRenderer(this) } }, modifier = modifier, + onRelease = { videoTrack.removeRenderer(it) } ) } diff --git a/sample/iosApp/iosApp/ContentView.swift b/sample/iosApp/iosApp/ContentView.swift index 3cd5c325..dc574782 100644 --- a/sample/iosApp/iosApp/ContentView.swift +++ b/sample/iosApp/iosApp/ContentView.swift @@ -16,6 +16,3 @@ struct ContentView: View { .ignoresSafeArea(.keyboard) // Compose has own keyboard handler } } - - -