Dear Apple Developer Forum Community, I hope this message finds you well. I am writing to seek assistance regarding an error I encountered while attempting to create a Vedic content in the app from the one YouTube link. I have been unsuccessful in resolving it. I am reaching out to the community in the hope that someone might have encountered a similar issue or have expertise in troubleshooting Xcode errors. Any guidance, suggestions, or solutions would be greatly appreciated. Thank you very much for your time and assistance. Sincerely, Zipzy [games]
Error in using the AV KIT in the Vision Pro for Vedic link app
Hello @ZIPZYGAMES0,
This is a Swift compiler error, the URL.init(string:) initializer returns an Optional<URL>, but the AVPlayerItem initializer you are using requires a non-optional URL.
You need to deal with the optional in some way, for example, something like this would compile:
guard let url = URL(string:
"https://youtu.be/pjD7Ki5s3k8") else { fatalError("Handle this case!") }
controller.player?.replaceCurrentItem(with: AVPlayerItem(url: url))
Video is still now playable please help