Post

Replies

Boosts

Views

Activity

TVOS 17 - Text Field in Alert adds a Button
When adding a textfield to an alert in SwiftUI (as shown below) the behavior changes from TVOS 16 to TVOS 17. In the simulator running TVOS 17, it displays an additional button labeled with the text from inside the textfield when the alert is presented. So, the alert below would have two buttons. One button would be labeled "OK" and run addFunction, and the other is labeled with whatever is in $url when the alert is presented and does nothing. Button { showAlert = true } label: { Image(systemName: "plus") } .alert("Add", isPresented: $showAlert) { Button("OK", action: addFunction) TextField("Enter URL", text: $url) .keyboardType(.URL) }
1
1
773
Oct ’23
AVPlayer kicks device off Airplay
On an Apple TV, if you have an app that triggers a video playing in AVPlayer while another device is air playing to the Apple TV. The device gets disconnected from Airplay and the video plays instead. There doesn't seem to be a way to sense that Airplay is happening or not happening from the Apple TV side programmatically or a way to prevent the behavior. Is this intentional? It would seem to make more sense to have Airplay take priority or push the app to the background.
0
0
844
Dec ’23
AVPlayer not Playing on tvOS 17.2
Loading a video that played on tvOS 17, won't now play in tvOS 17.2. It isn't true for all videos or even all videos of a certain type. This code works fine on tvOS 17, but not on 17.2 import SwiftUI import AVKit struct ContentView: View { var body: some View { let player = AVPlayer(url: URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")!) VideoPlayer(player: player) .onAppear { player.play() } } } I have tried reloading the metadata. I tried making the player from an AVAsset rather than a URL. I can't seem to see what is making it work with some videos and not all and what is different from tvOS 17 to 17.2.
5
1
1.2k
Jan ’24