tvOS is the operating system for Apple TV.

tvOS Documentation

Posts under tvOS tag

124 Posts
Sort by:
Post not yet marked as solved
0 Replies
52 Views
I'm attempting to integrate DRM into the app. I've developed a prototype, but the delegate method shouldWaitForLoadingOfRequestedResource isn't being triggered on certain devices, although it functions correctly on others. Notably, it's invoked on Apple TV 4K (3rd generation) Wi-Fi (A2737) but not on Apple TV HD (A1625). Are there any specific configurations needed to ensure this method is invoked? let url = URL(string: RESOURCE_URL)! // Create the asset instance and the resource loader because we will be asked // for the license to playback DRM protected asset. let asset = AVURLAsset(url: url) let queue = DispatchQueue(label: CUSTOM_SERIAL_QUEUE_LABEL) asset.resourceLoader.setDelegate(self, queue: queue) // Create the player item and the player to play it back in. let playerItem = AVPlayerItem(asset: asset) let player = AVPlayer(playerItem: playerItem) // Create a new AVPlayerViewController and pass it a reference to the player. let controller = AVPlayerViewController() controller.player = player // Modally present the player and call the player's play() method when complete. present(controller, animated: true) { player.play() } } //Please note if your delegate method is not being called then you need to run on a REAL DEVICE func resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool { // Getting data for KSM server. Get the URL from tha manifest, we wil need it later as it // contains the assetId required for the license request. guard let url = loadingRequest.request.url else { print(#function, "Unable to read URL from loadingRequest") loadingRequest.finishLoading(with: NSError(domain: "", code: -1, userInfo: nil)) return false } // Link to your certificate on BuyDRM's side. // Use the commented section if you want to refer the certificate from your bundle i.e. Store Locally /* guard let certificateURL = Bundle.main.url(forResource: "certificate", withExtension: "der"), let certificateData = try? Data(contentsOf: certificateURL) else { print("failed...", #function, "Unable to read the certificate data.") loadingRequest.finishLoading(with: NSError(domain: "com.domain.error", code: -2, userInfo: nil)) return false } */ guard let certificateData = try? Data(contentsOf: URL(string: CERTIFICATE_URL)!) else { print(#function, "Unable to read the certificate data.") loadingRequest.finishLoading(with: NSError(domain: "", code: -2, userInfo: nil)) return false } // The assetId from the main/variant manifest - skd://***, the *** part. Get the SPC based on the // already collected data i.e. certificate and the assetId guard let contentId = url.host, let contentIdData = contentId.data(using: String.Encoding.utf8) else { loadingRequest.finishLoading(with: NSError(domain: "", code: -3, userInfo: nil)) print(#function, "Unable to read the SPC data.") return false } guard let spcData = try? loadingRequest.streamingContentKeyRequestData(forApp: certificateData, contentIdentifier: contentIdData, options: nil) else { loadingRequest.finishLoading(with: NSError(domain: "", code: -3, userInfo: nil)) print(#function, "Unable to read the SPC data.") return false } // Prepare to get the license i.e. CKC. let requestUrl = CKC_URL let stringBody = "spc=\(spcData.base64EncodedString())&assetId=\(contentId)" let postData = NSData(data: stringBody.data(using: String.Encoding.utf8)!) // Make the POST request with customdata set to the authentication XML. var request = URLRequest(url: URL(string: requestUrl)!) request.httpMethod = "POST" request.httpBody = postData as Data request.allHTTPHeaderFields = ["customdata" : ACCESS_TOKEN] let configuration = URLSessionConfiguration.default let session = URLSession(configuration: configuration) let task = session.dataTask(with: request) { data, response, error in if let data = data { // The response from the KeyOS MultiKey License server may be an error inside JSON. do { let parsedData = try JSONSerialization.jsonObject(with: data) as! [String:Any] let errorId = parsedData["errorid"] as! String let errorMsg = parsedData["errormsg"] as! String print(#function, "License request failed with an error: \(errorMsg) [\(errorId)]") } catch let error as NSError { print(#function, "The response may be a license. Moving on.", error) } // The response from the KeyOS MultiKey License server is Base64 encoded. let dataRequest = loadingRequest.dataRequest! // This command sends the CKC to the player. dataRequest.respond(with: Data(base64Encoded: data)!) loadingRequest.finishLoading() } else { print(#function, error?.localizedDescription ?? "Error during CKC request.") } } task.resume() // Tell the AVPlayer instance to wait. We are working on getting what it wants. return true }
Posted Last updated
.
Post not yet marked as solved
2 Replies
962 Views
I made a minor change the UI of my tvOS App, and am now getting errors related to the App Icon. I have confirmed that all the background images DO match the requirements but App Store Connect won't let me upload: App Store Connect Operation Error Invalid Image Asset. The image stack 'App Icon' in 'Payload/My TV.app/Assets.car' has a background layer image that does not match the canvas dimensions '400x240'. App Store Connect Operation Error Invalid Image Asset. The image stack 'App Icon' in 'Payload/My TV.app/Assets.car' has a background layer image that does not match the canvas dimensions '800x480'. App Store Connect Operation Error Invalid Image Asset. The image stack 'App Icon' in 'Payload/My TV.app/Assets.car' has a background layer image that does not match the canvas dimensions '1280x768'. App Store Connect Operation Error Invalid Image Asset. The image stack 'App Icon' in 'Payload/My TV.app/Assets.car' has a background layer image that does not match the canvas dimensions '2560x1536'. App Store Connect Operation Error Invalid Image Asset. The App Store Icon must only contain an image with size (1280pt × 768pt @1x). Refer to https://developer.apple.com/tvos/human-interface-guidelines/icons-and-images/app-icon for more information Have the standards changed? Or is there another issue I should be looking at? Thanks!
Posted Last updated
.
Post not yet marked as solved
0 Replies
89 Views
Hello, I am new to Apple TV Development. I am researching if it would be possible to develop a tvOS App for IPTV that consumes content entirely from an API in the local network (I have domain such as sampleserver.com that points to a local network IP such as 192.168.1.10 ) and also plays back m3u8 HLS sources (live and VOD) produced in that local network server. No content comes from the cloud. Here are my questions: Would Apple approve this kind of app in the App Store? Or will Apple ask me to instead deploy this as a "Custom App" with Apple Business Manager and an MDM server? Is there an App Builder technology that fits better for this use case, such as TVML? If this app is published in the App Store and a user that is not in that local network, is there a guideline from Apple that I should follow to let the user know that he does not have access to the local content?
Posted
by jienco.
Last updated
.
Post not yet marked as solved
0 Replies
72 Views
Invalid Image Asset. The image stack 'App Icon' in 'Payload/VBIC.app/Assets.car' has a background layer image that does not match the canvas dimensions '800x480'. (ID: 9984fc86-f4b8-4968-9640-c368bd988a9b) PLATFORM AND VERSION tvOS Xcode Version 15.3 (15E204a) We verified several times and recreated all images. Error persists and is repeatable.
Posted Last updated
.
Post not yet marked as solved
0 Replies
70 Views
We have built the game on Unreal engine 4 and we have optimised the game to run on tvOS devices newer than 2017 (viz. Apple TV 4k and above). We could not bring it down to support Apple TV HD (2015) due to its visual and memory requirements. Is there a way to exclude Apple TV HD from support list. We couldnt find any required device capability to add to info.plist (eg: iphone-ipad-minimum-performance-a12, we tried it but this does not work for tvOS build).
Posted Last updated
.
Post not yet marked as solved
1 Replies
206 Views
I'm trying to do something so seemingly basic, yet I can't get it to work and I'm flummoxed. In a basic, vanilla SwiftUI app for tvOS, embed a single Text element with a very long string (hundreds of lines) in it: struct ContentView: View { var body: some View { ScrollView(.vertical) { Text(veryLargeString) .focusable() } } } Then fire up the app on tvOS, and it will not scroll. No matter what I do. Pressing arrow keys, swiping fast with my thumb, and nothing. It will not move. Ironically, in the Xcode SwiftUI Preview window—it does scroll, so that's always a fun tease. What I do know is that the focus engine is throwing a few errors, so it's leading me to believe the issue is with how I have the focusable element attached. I'm using a combination of -UIFocusLoggingEnabled YES as well as listening for UIFocusSystem.movementDidFailNotification. Unfortunately since this is SwiftUI, the notification failure and debugging logs aren't really all that actionable. Help appreciated!
Posted Last updated
.
Post not yet marked as solved
0 Replies
106 Views
I know that this is not a coding question and I have posted on the regular Apple Forum and have been working with the 800 Tech Support folk for 4 months. I am in a world of hurt. Have ATV + Samsung TV + external soundbar. All software versions are current NO Cable box (direct input). 4 months ago I had Cable box = zero problems. With Samsung on and ATV off, stereo = Dolby 5.1 sounds great. With ATV also on, no stereo. I can use Siri remote to activate stereo until I change to a new movie. ATV then reverts to mono = PCM One Tech Support lady said to just not watch multiple movie. ?$@!*+^? I have spoken with engineers at Samsung and Sonos (soundbar). Both say my cabling is correct = 1 cable from soundbar to HDMI Arc on TV + 1 cable from ATV to another HDMI port on TV. Another Tech Support folk said to connect ATV to soundbar. Soundbars don’t have gobs of HDMI ports, the TV does. ?!$@*^+%# I have spoken with Apple Tech Support with zero help for 3-4 months. I think I have been a good soldier. But it is time for real results. Please help
Posted
by JohnLove.
Last updated
.
Post not yet marked as solved
0 Replies
212 Views
I am trying to Execute Universal Link of Netflix show from My App in tvOS 17.2 When I Call the open(_:options:completionHandler:) to execute the Link it does open the Netflix App but open the landing page of Title. I have tried different alternative links but all has same behaviour. The same Link works in iOS ans iPad OS. Here the links that I have tried and the code that handles the universal Link. http://www.netflix.com/title/81731618 nflx://www.netflix.com/title/81731618 // Handle remote notification here // For example, extract deep link and perform appropriate action if let deepLink = userInfo["deep_link_key"] as? String { // Handle the deep link here print("Received Deep Link: \(deepLink)") if let url = URL(string: deepLink) { UIApplication.shared.open(url) } } }
Posted
by cylon147.
Last updated
.
Post not yet marked as solved
0 Replies
221 Views
How to implement Player in SwiftUI with support for parental controls? Sample Code: Working with Overlays and Parental Controls in tvOS I use AVPlayerViewController in SwiftUI. On cancel, rejecting the request, the screen is black. On change the channel, on move command up or down direction, I am replacing the current player item with new. Status is ready to play, status of the request is successful upon replacement and I set player to play. The screen is still black.
Posted
by ina4.
Last updated
.
Post not yet marked as solved
0 Replies
182 Views
I am trying to write to a characteristic and I know that it needs to be paired via a pin/passcode in order to initiate transfer of data. But it only pairs with 'just works' method and does not allow for transfer for data. Is connecting possible with pin/passcode via BLE on TVOS? Seems like it's not.
Posted
by JSyquia.
Last updated
.
Post not yet marked as solved
0 Replies
268 Views
Hi guys, Since SwiftUI is not completely suporting tvOS remote and swipe/pan gestures (targeting tvOS 16 and higher, using Xcode 15.1 and its tvOS SDK), I have implemented custom remote control handling using GameController framework and GCController class to detects Siri Remote (1st and 2nd generation), iOS Remote (tvOS remote controller on iPhone) and Nimbus+ and PS game controllers. For video streaming app I specifically needed to handle arrows on old Siri remote and new Siri remote the same way - arrow press (not just touch) switches TV channel. In the standard SwiftUI remote control handling the arrow presses are triggered on old remote just by touching edges of the touch pad. We use Up/Down arrow presses to switch TV channel. Our testers reported that they too often accidentally change channel when picking up remote or simply laying down finger on the pad in preparation to use the remote for some action. That's why we needed to override default behavior on old remote and detect arrow press only when user touches the edge and "clicks" the touch pad. Simultaneously we detect input from all controllers, because for example when you have Nimbus game controller connected it becomes current controller - it is set in GCController.current - while we still need to handle Siri remote, so user didn't have to turn off Game controller and could just pick up the Siri remote and use it right away. But there are still some problems. For example if I open tvOS remote control app on iPhone it has higher priority over Siri remote. Although I'm able to hold iPhone in one hand and Siri remote in the other and use them simulatanously, pressing down arrow buttons on Siri remote triggers event, which is being detected as if it came from iOS remote. This problem occurs even if user locks iPhone while remote app is active. User has to unlock iPhone and minimize iOS remote to fix the problem and make Siri remote fully active controller with arrows working as expected. Is there a way of detecting from which remote the button press event came? GCController.current reports that iOS remote is current controller, notification GCControllerDidConnect and GCControllerDidBecomeCurrent does not help either. When I use iOS remote it becomes current controller and when I start using Siri remote and press button it does not become current controller. GCController.physicalInputProfile does not help either. It is as if iOS remote while being connected to tvOS has higher priority over Siri remote. Why don't I receive current controller change when pressing button on Siri remote? When pressing the button on Siri remote and receiving event, it comes from handler with GCController.microGamepad.elements.count == 10, instead of 17, so although I'm pressing button on Siri remote I'm getting events as if I pressed button on old remote (or iOS remote which is handled as old Siri remote). Even button.controller instance is wrong and holds a reference to iOS remote instead of the correct new Siri remote. I tried to look at button.aliases to see if I find "Cardinal Direction", which would hint at arrow press on new controller, but it does not contain this type of alias. I'm trying to find some hack for detection of currently used Siri remote, but without any success. It looks like somewhere in the core the GCController converts button presses to more generic events making the button presses anonymous (losing hardware info). But clearly the low level code must see from which controller the button press came. Any idea if there is a way of detecting from which remote controller the button press came?
Posted Last updated
.
Post not yet marked as solved
0 Replies
284 Views
Hello, my company ordered Apple TV 4K HDMI + WIFI only.. The device has no ethernet or USB-C port. Only has HDMI and power port. I read on Apple's website to connect to Apple configurator I have to do it via WIFI. I followed the steps from the Apple website (https://support.apple.com/en-ca/guide/apple-configurator-2/cada1ba9dab1/mac) but once I'm paired to the Apple TV and I try to "Prepare" in Apple configurator to get the device setup on MDM it tells me the AppleTV device is already prepared and asks to "Erase" which I do then the Apple TV is back to the beginning setup screen and no longer connected to WIFI... Once I run through the setup again and get back on WIFI and goto pair screen it says the same thing when I try to prepare again.. Just going in circles and not getting anywhere.. Anyone have a solution? Prepare Apple TV HD or Apple TV 4K using Wi-Fi or Ethernet Make sure your Apple TV is connected to the same network your Mac is connected to. Make sure the Apple TV is at the first screen of the Setup Assistant that says Pair Your Remote. Launch Apple Configurator 2 . From the Apple Configurator 2 menu, choose Paired Devices. Select your Apple TV in the Paired Devices list, then click Pair. Enter the six-digit personal identification number (PIN) that appears on the screen of your Apple TV. Select your Apple TV in the device window of the Apple Configurator 2. Click Prepare and follow the onscreen instructions to set up your Apple TV.
Posted Last updated
.
Post not yet marked as solved
0 Replies
277 Views
We have an video app that puts up it's own screen saver after some idle time to prevent TV screen burn-in. Is there a way to stop video (including downloading segments) while still maintaining audio playback? I see the currentItem has different tracks and can enable/disable closed captioning for instance, but this doesn't work for the video track. Is it even possible? -B
Posted
by byrtM.
Last updated
.
Post not yet marked as solved
0 Replies
305 Views
I have a tvOS project contains an App target and 3 static libraries: EntryPoint – Static library that contains main , AppDelegate and SceneDelegate Experience – Static library containing my UI elements AppTarget – executable built using above two libraries I have a class "SelectionTable" which subclasses UITableView in Experience target : import UIKit class SelectionTable : UITableView { private var vDataSrc:[String]! func SetDataSrc (_ pDataSrc:[String]) { self.vDataSrc = pDataSrc } func UpdateDataSrc (_ pStringList:[String]) { self.vDataSrc += pStringList } func GetDataSrc () -> [String] { return self.vDataSrc } } I am not using this class anywhere and still i am getting these errors when i build my AppTarget: Cannot find interface declaration for 'UITableView', superclass of 'SelectionTable' Expected a type These above error are coming in generated header file "Experience-Swift.h". This file is auto-generated by compiler. I am not using @objc anywhere in the code, But still the Target-Swift.h file has the below lines: SWIFT_CLASS("_TtC10Experience22SelectionTable") @interface SelectionTable : UITableView - (nonnull instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER; @end When i am marking above class as Private , this error goes away . And also , if i am defining SelectionTable class in EntryPoint library , this error does not occur . I am using similar model for an iOS project also and there i am not facing this issue. I am using :- Swift version : Swift 5.9.2 XCode version : 15.2
Posted Last updated
.
Post not yet marked as solved
0 Replies
270 Views
Hello, We would like to create a custom keyboard for our tv app, while also keeping the features of dictation and device input (via phone or pad). However setting the inputView on the UITextField does not work. When the textfield is focused/selected it should show the inputView. Instead it does nothing, freezes and builds up memory usage slowly until it goes OOM and crashes. Setting any view (empty UIView()) on a UITextField will reproduce the issue. Reproducible on tvOS 16 and 17. Test project added to github for reproduction: https://github.com/drs-st/test-tvos-custom-inputview/blob/develop/TestKeyboard/ViewController.swift
Posted Last updated
.
Post not yet marked as solved
0 Replies
280 Views
I was shutdown tvOS simulator as hold TV/Control center button and select Shutdown. How turn on? Im trying press/hold menu/tv/any buttons, simulate not react, I see only black screen
Posted
by gruzd1sok.
Last updated
.
Post not yet marked as solved
2 Replies
316 Views
If users press the menu button multiple times from any page, it is likely to exit the app. I think it would be nice to have an alert before exiting the app. I have noticed that some apps on other platforms have this feature; however, I am not sure if it is allowed on tvOS. The logic would be something like this: Users tap the menu button. Show an alert with 'Cancel' and 'Exit' buttons. If 'Cancel' is tapped, go back to the app. If 'Exit' is tapped, exit the app by calling UIApplication.shared.perform(#selector(NSXPCConnection.suspend)). Will calling NSXPCConnection.suspend get my app rejected from Apple? It seems like a reasonable feature, though."
Posted
by ANATest.
Last updated
.
Post not yet marked as solved
3 Replies
444 Views
I have an AppleTV app which I released in 2016. I've updated it and released a new version every year without much hassle. This year, with tvOS 17.2, the layered app icon isn't working right. This is a two-layer image made with PNGs. When it's selected, it looks right and the layers move correctly: But when it's not selected, the background layer disappears: Screenshots are from the simulator but it also happens on the device. It's inconsistent; sometimes it's the front layer that disappears. Occasionally both layers work, but I can't tell why. I've spent a day trying everything. Very frustrated. The icon previews correctly in Xcode and in Parallax Viewer. The image sizes are correct: 400 x 240 for Small, 800 x 480 for Small@2x, 1280 x 768 for Large. The back layer is a non-transparent PNG. I tried adding a Large@2x set. Didn't help. Originally I had a three-layer image with no middle layer PNG. I deleted the empty middle layer, but that didn't help. All the PNG files are from GnuIMP. Same color space, even. I was using the filenames tvicon-back-s.png and tvicon-back-s@2x.png. I tried taking out the @ sign in case that was confusing Xcode. (It never has before, but I am flailing here.) Anybody have any clues? If it's an Apple bug and there's nothing I can do, I'm going to just push the release button and hope it fixes itself someday.
Posted
by erkyrath.
Last updated
.