Post

Replies

Boosts

Views

Activity

Show some placeholder until video loads in immersive view Vision OS
I am playing immersive video as shown in picture but it displays black screen until videos get loaded and here is when video gets loaded here is code snippet struct ImmersiveMeditationPlayerView: View { @Environment(\.dismissImmersiveSpace) private var dismissImmersiveSpace @Environment(\.openWindow) private var openWindow let player = AVPlayer() init() { Logger.shared.log(message: "IMERSIVE VIEW INSIDE") } var body: some View { VStack { RealityView { content, attachments in //Create Entity for the video let videoEntity = Entity() let url = URL(string: "https://videoc2CIarRqKp")! let asset = AVURLAsset(url: url) let playerItem = AVPlayerItem(asset: asset) //create a videoMaterial let material = VideoMaterial(avPlayer: player) //Made a Sphere with the videoEntity and asign the videoMaterial to it videoEntity.components.set(ModelComponent(mesh: .generateSphere(radius: 1E3), materials: [material])) //adjust the properties of the videoEntity(Sphere) if needed videoEntity.scale = .init(x: 1, y: 1, z: -1) videoEntity.transform.translation += SIMD3<Float>(0.0, 10.0, 0.0) let angle = Angle.degrees(90) let rotation = simd_quatf(angle: Float(angle.radians), axis: .init(x: 0, y: 0, z: 0)) videoEntity.transform.rotation = rotation //add VideoEntity to realityView content.add(videoEntity) //start the VideoPlayer player.replaceCurrentItem(with: playerItem) player.play() } attachments: { Attachment(id: "myMeditationBuilderView") { } } }
2
0
649
Jan ’24
Present View in trailing area of a view in Vision OS
I want to present a view in trailing area of a view and on presented view I need to navigate on other views like push other items but those views will have a 1280 / full width I have presented view as sheet but its coming at centre of screen and detail views after sheet are having same width as sheet had for example if user press how it works than the new view that is being pushed to stack will have full width not the width that sheet have
0
0
269
Jan ’24