Post

Replies

Boosts

Views

Activity

HEVC Video with Alpha in SwiftUI
After stumbling upon this video from WWDC '19, I have been trying to get transparent HEVC (H.265) videos to play in SwiftUI. Unfortunately I have been unable to get it working. Is this truly supported in iOS and tvOS 13+? Here is my code: import AVKit import SceneKit import SpriteKit struct VideoView: View {     @State var videoPlayer = AVPlayer(url:  Bundle.main.url(forResource: "fl", withExtension: "mov")!)     @State var mainScene = SKScene(size: CGSize(width: 500, height: 500))          var body: some View {         HStack {             Spacer()                          VStack {                                  Spacer()                 SpriteView(scene: mainScene)                                  Spacer()                              }.onAppear {                 guard let scene = SKScene(fileNamed: "backgroundScene") else {                     print ("Could not create a background scene")                     return                 }                                  scene.scaleMode = .aspectFill                 scene.backgroundColor = .blue                 scene.view?.allowsTransparency = true                 guard let alphaMovieURL = Bundle.main.url(forResource: "output", withExtension: "mov") else {                     print("Failed to overlay alpha movie on the background")                     return                 }                                                   videoPlayer = AVPlayer(url: alphaMovieURL)                                  let video = SKVideoNode(avPlayer: videoPlayer)                 video.size = CGSize(width: 500, height: 500)                 scene.addChild(video)                 videoPlayer.play()                 mainScene = scene             }             Spacer()         }.background(Color.red)     } } The file I have been using can be found here: https://firebasestorage.googleapis.com/v0/b/leaderboard-d5992.appspot.com/o/fl.mov?alt=media&token=c939cdfc-5047-4c86-a38d-89d5a0f3c459 It very well could be that the encoding is wrong, although I have checked it many times and it definitely contains an alpha layer. Any direction or pointers would be greatly appreciated!
3
0
1.7k
Jul ’22
AppShortcuts are not installing on device
Using iOS 17.2. (no Beta) and the following code, I am still unable to use AppShortcuts in Siri, or in the Shortcuts app. The AppIntent is showing in the Shortcuts app, but the AppShortcut is not. I've tried cleaning the build folder, restarting the device, reinstalling both Shortcuts and my app, and even creating a blank project and trying it. I'm sure there is something simple I am missing, can anyone see something wrong with this code? Is there some config I need to complete for this to work? struct TestIntent: AppIntent { static var title: LocalizedStringResource = "Test a basic intent" static var description = IntentDescription("just another basic test intent") func perform() async throws -> some IntentResult { print("Test intent has been called") return .result(value: "Test intent was successful") } } struct TestAppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: TestIntent(), phrases: [ "Test Add Point" ], shortTitle: "TEST THIS SHORTCUT", systemImageName: "money" ) } }
1
1
472
Dec ’23