@@ -38,23 +38,32 @@ fun SpatialExternalSurfaceContent() {
3838 Subspace {
3939 SpatialExternalSurface (
4040 modifier = SubspaceModifier
41- .width(1200 .dp)
42- .height(676 .dp),
41+ .width(1200 .dp) // Default width is 400.dp if no width modifier is specified
42+ .height(676 .dp), // Default height is 400.dp if no height modifier is specified
43+ // Use StereoMode.Mono, StereoMode.SideBySide, or StereoMode.TopBottom, depending
44+ // upon which type of content you are rendering: monoscopic content, side-by-side stereo
45+ // content, or top-bottom stereo content
4346 stereoMode = StereoMode .SideBySide ,
4447 ) {
4548 val exoPlayer = remember { ExoPlayer .Builder (context).build() }
4649 val videoUri = Uri .Builder ()
4750 .scheme(ContentResolver .SCHEME_ANDROID_RESOURCE )
51+ // Represents a side-by-side stereo video, where each frame contains a pair of
52+ // video frames arranged side-by-side. The frame on the left represents the left
53+ // eye view, and the frame on the right represents the right eye view.
4854 .path(" sbs_video.mp4" )
4955 .build()
5056 val mediaItem = MediaItem .fromUri(videoUri)
5157
58+ // onSurfaceCreated is invoked only one time, when the Surface is created
5259 onSurfaceCreated { surface ->
5360 exoPlayer.setVideoSurface(surface)
5461 exoPlayer.setMediaItem(mediaItem)
5562 exoPlayer.prepare()
5663 exoPlayer.play()
5764 }
65+ // onSurfaceDestroyed is invoked when the SpatialExternalSurface composable and its
66+ // associated Surface are destroyed
5867 onSurfaceDestroyed { exoPlayer.release() }
5968 }
6069 }
0 commit comments