Skip to content

Commit 0797c84

Browse files
committed
Add PlayerSurface to video edit screen to replace the current AndroidView approach.
1 parent 50923ef commit 0797c84

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

app/src/main/java/com/google/android/samples/socialite/ui/videoedit/VideoEditScreen.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ import androidx.media3.common.util.UnstableApi
9393
import androidx.media3.transformer.Composition
9494
import androidx.media3.transformer.CompositionPlayer
9595
import androidx.media3.ui.PlayerView
96+
import androidx.media3.ui.compose.PlayerSurface
9697
import com.google.android.samples.socialite.R
9798
import kotlinx.coroutines.Dispatchers
9899
import kotlinx.coroutines.launch
@@ -552,17 +553,12 @@ private fun VideoMessagePreview(
552553
// CompositionPlayer is still under active development
553554
var compositionPlayer by remember { mutableStateOf<CompositionPlayer?>(null) }
554555

555-
AndroidView(
556-
factory = {
557-
playerView.apply {
558-
player = compositionPlayer
559-
controllerAutoShow = false
560-
}
561-
},
556+
PlayerSurface(
557+
compositionPlayer,
562558
modifier = Modifier
563559
.width(250.dp)
564560
.height(450.dp),
565-
)
561+
)
566562

567563
LaunchedEffect(previewConfig) {
568564
// Release the previous player instance if it exists

0 commit comments

Comments
 (0)