Create client-server apps by incorporating JavaScript and TVML files in your binary app using TVMLKit.

Posts under TVMLKit tag

13 Posts

Post

Replies

Boosts

Views

Activity

How to Properly Integrate Google IMA SDK for Pre-roll, Mid-roll, and Post-roll Ads in a tvOS App using TVJS and Swift?
I'm working on a tvOS application that plays video content using TVMLKit/TVJS. I'm trying to integrate Google IMA SDK to show pre-roll, mid-roll, and post-roll ads in my app. Here’s what I’ve done so far: Video playback is handled through JavaScript in application.js. Ads are managed in Swift using Google IMA SDK. I use the evaluateJavaScript bridge to control video playback from Swift. I pause and resume the TVJS player (Player object) using a function like startPlayingVideo(value) from Swift based on the ad lifecycle. Current Flow: When the video is about to start, I call loadAds() from JS. This presents a Swift ViewController that handles IMA ad requests. On adsManagerDidRequestContentPause, I pause the video using JS via the bridge. On adsManagerDidRequestContentResume, I resume the video. The Issue: This setup doesn't behave consistently: Sometimes the ad plays in the background and video started playing as well but can not see the ad. Not able to see the post-roll ads Relevant Code Snippets: application.js function startPlayingVideo(value) { if (playerReference != undefined) { if (value == true) { playerReference.play(); else { playerReference.pause(); } } } function playVideo(videoURL) { setup playerReference, push mediaItem, etc. loadAds(); player.present(); } AppDelegate.swift let loadAds: @convention(block) () -\> Void = { DispatchQueue.main.async { let adManagerVC = ViewController() AppDelegate.tvController?.navigationController.present(adManagerVC, animated: true) } } let updateVideoPlayTime: @convention(block) (Double) -\> Void = { time in CustomContentPlayhead.shared.currentTime = TimeInterval(time) } ViewController.swift func adsManagerDidRequestContentPause(\_ adsManager: IMAAdsManager) { showAdUI() playerViewController.player?.pause() } func adsManagerDidRequestContentResume(\_ adsManager: IMAAdsManager) { hideAdUI() // Expecting JS video to resume via bridge } And yeah my IMSDK Implementation is working fine if I am using it with swift AVPlayer. What I Need Help With: Best practice for coordinating video playback between JS (Player) and Swift (IMAAdsManager). How can I sync the playhead reliably between JS and Swift? Is there a better way to pause/resume TVJS player from Swift during ad lifecycle? How to reliably insert mid-roll ads when the playback is primarily controlled in JS? Any insights, code examples, or recommended architecture improvements would be greatly appreciated!
0
0
186
Jun ’25
How to Display Multiple Fields in a User Registration Form Using TVML for Apple TV?
Hello, I am currently developing an application for Apple TV using TVML, and I am trying to create a user registration or login form with multiple input fields (e.g., "Username" and "Password"). However, I am facing issues with displaying multiple textField components in the formTemplate. Here are the approaches I have tried: Attempt 1: <document> <formTemplate> <banner> <title>Login</title> </banner> <banner> <textField>UserName</textField> </banner> <banner> <textField>Password</textField> </banner> <footer> <button id="button1"> <text>Button 1</text> </button> </footer> </formTemplate> </document> Attemp 2: <document> <formTemplate> <banner> <title>Login</title> </banner> <textField>UserName</textField> <textField>Password</textField> <footer> <button id="button1"> <text>Button 1</text> </button> </footer> </formTemplate> </document> In both cases, the layout does not render the fields as expected. Either the textField components do not display at all, or the structure seems incorrect. Could someone please guide me on the proper way to display multiple textField components in a formTemplate? Is there a limitation or specific requirement for structuring these elements? Thank you in advance for your assistance!
0
0
603
Jan ’25
I want to establish connection between iOS app and Apple TV via WIFI to develop apple tv remote app, Any one have idea how?
I'm looking to develop an iOS application that functions as a remote for Apple TV, including discovering Apple TV devices over Wi-Fi. If anyone has experience building similar applications, could you share insights on available frameworks or protocols to discover Apple TVs? Additionally, if there are reference apps on the App Store that work like Apple's default remote app, I would greatly appreciate recommendations. Any guidance from developers who have worked on similar projects would be very helpful!
1
0
534
Oct ’24
TVML apps cause memory leaks
Hi all ! I have been working a while in this issue , first i started instrumenting our product trying to remove all dependency that can be causing retain memory until the app source only contains the AppDelegate and the TVApplicationController delegates implementation loading the TVML App and the Javascript context. After that i just realise that any TVOS app using TVMLKit retain memory without cause and that eventually will provoque a CRASH exception because the device it will run outs memory. I realise that by implementing a Hello World TVML App and doing MemoryLeaks instrument measurements and is imposible to know where is the source of this memory retentions when the app start. ** For the folks of Apple Developer Technical Support (DTS) : ** Case ID : 3279774 Apple Feedback link : https://feedbackassistant.apple.com/feedback/12540693 Anyone else seeing this issue? We have all our customers impacted by this problem
0
0
737
Aug ’23
TVML Player JS start playing delay content behind the current LIVE timestamp
Hi all ! I have been working a while on this problem . Turns out some of our customers when playing LIVE HLS content through a TVML Application using the standard Player JS API , for some channels the content start playing 5 mins before live timestamp witch is an unexpected behavior using this Player API. As a developer , i took the channels customer content and implement 2 Sample tvOS Apps : By using Fairplay + AVPlayerController , all native implementation and the issue is not reproducible . By using FairPlay + Player JS API , a TVML Sample implementation and the issue i always reproducible. **For the folks of Apple Developer Technical Support (DTS) : ** Case ID : 3280424 Apple Feedback link : https://feedbackassistant.apple.com/feedback/12565232 Anyone else seeing this issue?
0
0
756
Aug ’23
TVML Basic and Technical Questions from TVML Rookie
Hi Guys, I did lot of iOS, tvOS and macOS developemnt with UIKit and SwiftUI, but TVML appears to have really steep learning curve. When searching online and in this forum, posts are 7 years old and most often there are no replies. Is TVML something already obsolete and abandoned by Apple? Does it make sense to try quickly building streaming app using TVML? Is it better to start in SwiftUI and build templates from scratch and forget about TVML? What's nice that I can quickly build a page with collections of videos, however I struggle for several hours to do the simplest thing like adding a simple element with title, subtitle and play button. Why this doesn't display anything inside stackTemplate? <banner> <stack> <title>My Title</title> </stack> </banner> Why this doesn't display anything inside stackTemplate? <collectionList> <shelf id="row0"> <section binding="items:{videos}"> <prototypes> <lockup prototype="play" videoURL="https://storage.googleapis.com/media-session/sintel/trailer.mp4" > <title style="margin: 20; color: white; font-size: 60" binding="textContent:{title}"/> </lockup> </prototypes> </section> </shelf> If I add image to the loclkup element, it works and displays image and title. But if I want to add only title and subtitle and play button, it doesn't work. Is img manadatory inside lockup element? In documentation I cannot find, which subelement is mandatory and which is optional. Why cannot I add stack element as a prototype into the section element? Although I'm a native developer and don't really like HTML, I thought that TVML works in a similar way and I can add almost any element into any other element, like building HTML and TVML platform will stack up UI elements based on that. However it appears to be severely limited. Rules for even a basic element inside another layout element are so strict that I cannot tell ahead if it's going to work. Why doesn't it at least display elements that are defined correctly? Usually when one of the elements is invalid, then the whole section or shelf or container in general is hidden from view. It's impossible to build UI from the ground up. For example I thought I could add lockup element with title, see how it looks, than add subtitle and continue adding elements one by one. However if lockup with title simply doesn't display at all, I cannot figure out what's wrong, there is no error message in the console. Documentation is insufficient, it's not possible to figure out from that how each TVML UI elements works, what's mandatory and what's optional, sometimes I was actually add element inside another element even though docs didn't say it's possible. Like adding stack to some element, which I no longer rememeber. Is it possible to debug TVML somehow? Is it possible to debug JS in Xcode? Is there any TVML preview like in case of xib or SwiftUI? So far I always have to rebuild the app and look in the simulator screen. But often it caches the results and I have to delete the app from simulator, clean the build and rebuild again. It's very time consuming. Is there nay way to clear the cache (hot key)? Thanks.
0
1
1.1k
Jul ’23
Cannot play videos on tvOS 16.
What is causing the problem with the app and how should I approach the solution? I have taken over the development of a video viewing application that runs on tvOS. Recently, a user reported that he could not play videos on tvOS 16. I built the application in xcode and tried to play the video on tvOS 16.4 in simulator. Then a symbol similar to 🚫 appeared on the video player and the video could not be played. UIKit and TVML Kit JS are used in the source code. Video source is HLS with H.264 codec When playback failed, Xcode displayed the following error message. 023-05-26 12:59:58.477905+0900 hoge_tvOS[35421:14197398] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x6000007080a0 H:|-(95)-[UIStackView:0x155247910] (active, names: '|':UIView:0x155247770 )>", "<NSLayoutConstraint:0x6000007082d0 UIStackView:0x155247910.trailing == UIView:0x155247770.trailing - 95 (active)>", "<NSLayoutConstraint:0x6000007f38e0 H:|-(0)-[UIView:0x155247770] (active, names: '|':_AVFocusContainerView:0x151d431f0 )>", "<NSLayoutConstraint:0x6000007f3930 UIView:0x155247770.trailing == _AVFocusContainerView:0x151d431f0.trailing (active)>", "<NSLayoutConstraint:0x60000070b1b0 '_UITemporaryLayoutWidth' _AVFocusContainerView:0x151d431f0.width == 0 (active)>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x6000007082d0 UIStackView:0x155247910.trailing == UIView:0x155247770.trailing - 95 (active)> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. I have confirmed in the past that it can be played on tvOS 14. Thanks for reading.
0
3
979
Jul ’23
SAP GUI 7.70 for JAVA Environment
Translated Report (Full Report Below)   Process:              SAPGUI [1388] Path:                 /Applications/SAP Clients/*/SAPGUI 7.70rev3.app/Contents/MacOS/SAPGUI Identifier:           com.sap.platin Version:              770.4.300 (770.4.300) Code Type:            X86-64 (Native) Parent Process:       launchd [1] User ID:              502   Date/Time:            2022-03-29 09:41:01.4338 +0100 OS Version:           macOS 12.3 (21E230) Report Version:       12 Anonymous UUID:       0EB8A533-EF4A-BF01-1D6B-A349CA5F2736     Time Awake Since Boot: 1800 seconds   System Integrity Protection: enabled   Crashed Thread:       42 Java: InvokeLaterDispatcher   Exception Type:       EXC_CRASH (SIGABRT) Exception Codes:      0x0000000000000000, 0x0000000000000000 Exception Note:       EXC_CORPSE_NOTIFY   Application Specific Information: abort() called   Model: MacBookPro14,1, BootROM 447.80.3.0.0, 2 processors, Dual-Core Intel Core i5, 2,3 GHz, 8 GB, SMC 2.43f11 Graphics: Intel Iris Plus Graphics 640, Intel Iris Plus Graphics 640, Built-In Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039 Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039 AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x170), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1710.3) AirPort: Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports Network Service: Wi-Fi, AirPort, en0 USB Device: USB30Bus Thunderbolt Bus: MacBook Pro, Apple Inc., 41.5
0
0
2.0k
Mar ’22
tvOS: Create a Search TVML Page with TVML SearchTemplate
This is the TVML SearchTemplate (taken from Apple's Docs: https://developer.apple.com/library/prerelease/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/SearchTemplate.html#//apple_ref/doc/uid/TP40015064-CH33-SW1var Template = function() { return `&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;document&gt; &lt;head&gt; &lt;style&gt; .suggestionListLayout { margin: -150 0; } &lt;/style&gt; &lt;/head&gt; &lt;searchTemplate id="tmpl_search"&gt; &lt;searchField/&gt; &lt;collectionList&gt; &lt;separator&gt;&lt;/separator&gt; &lt;/collectionList&gt; &lt;/searchTemplate&gt; &lt;/document&gt;` }It's something very basic.When the template is populated by some items it looks like the followingvar Template = function() { return `&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;document&gt; &lt;head&gt; &lt;style&gt; .suggestionListLayout { margin: -150 0; } &lt;/style&gt; &lt;/head&gt; &lt;searchTemplate&gt; &lt;searchField/&gt; &lt;collectionList&gt; &lt;shelf&gt; &lt;header&gt; &lt;title&gt;Shelf Title&lt;/title&gt; &lt;/header&gt; &lt;section&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/movies/movie_520_e1.lcr" width="350" height="520" /&gt; &lt;title&gt;Title 1&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/movies/movie_520_e2.lcr" width="350" height="520" /&gt; &lt;title&gt;Title 2&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/movies/movie_520_e3.lcr" width="350" height="520" /&gt; &lt;title&gt;Title 3&lt;/title&gt; &lt;/lockup&gt; &lt;/section&gt; &lt;/shelf&gt; &lt;grid&gt; &lt;header&gt; &lt;title&gt;Grid Title&lt;/title&gt; &lt;/header&gt; &lt;section&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/music/music_520_e1.lcr" width="350" height="350" /&gt; &lt;title&gt;Title 1&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/music/music_520_e2.lcr" width="350" height="350" /&gt; &lt;title&gt;Title 2&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/music/music_520_e3.lcr" width="350" height="350" /&gt; &lt;title&gt;Title 3&lt;/title&gt; &lt;/lockup&gt; &lt;/section&gt; &lt;/grid&gt; &lt;/collectionList&gt; &lt;/searchTemplate&gt; &lt;/document&gt;` }Now, as soon as you name the template you should be able to get access to it in your Presenter code, that register events for the new Document:resourceLoader.loadResource(templateURL, function(resource) { if (resource) { var doc = self.makeDocument(resource); self.currentDOMDocument=doc // DOM Document "onload" event doc.addEventListener("load", self.dispatch.bind(self)); // DOM element "select" | "highlight" event doc.addEventListener("select", self.load.bind(self)); doc.addEventListener("highlight", self.load.bind(self)); if (self[presentation] instanceof Function) { self[presentation].call(self, doc, ele); } else { self.defaultPresenter.call(self, doc); } } } )So, in this case the event should be a "select" event on the search field:&lt;searchField/&gt;and so you will be able to get the featured i.e. the keyboard and to attach events for the input like:var formTemplate = ele.parentNode.parentNode; // your formTemplate button var children = formTemplate.childNodes; var textField = children.item(1); // replace "1" with the index of "textField" element in your template var keyboard = textField.getFeature("Keyboard"); // get the textField's Keyboard elementand the input textvar userValue = keyboard.text.replace(/-/g,""); // the value entered by the user on the Apple TV keyboardAt the "load" event you can attach events to get input changes like:var children = ele.childNodes; var textField = children.item(1); // replace "1" with the index of "textField" element in your template var keyboard = textField.getFeature("Keyboard"); // get the textField's Keyboard element keyboard.onTextChange = function () { console.log("onTextChange "+keyboard.text) if( keyboard.text.length &amp;&amp; !((keyboard.text.length+1) % 5) ) { // every 4 chars keyboard.text+='-'; } } }At this time you have the query string for your Search API.As soon as you get a callback from your API (that could make use of sayts - Search As You Type),we need to dynamically add items to the search results as new&lt;shelf/&gt;and inside a list of&lt;section&gt;&lt;lockup/&gt;&lt;/section&gt;lockup items. So how to dynamically add now these elements?
5
0
3.1k
Jan ’22
Proper way to call back into JavaScriptCore from native
In our tvOS app we have a couple of hooks into the native side where we receive events over a WebSocket in (using CocoaAsyncSocket) native and propagate those events into the JavaScript layer. The calls into the JS layer are structured like this:self.receiveQueue.addOperation { websocket.invokeMethod("onmessage", withArguments: [["data": text]]) }Where `receiveQueue` is an `OperationQueue`. This works great most of the time, but we occasionally see application crashes where it seems a memory reference has gone bad. However, we've found that if we take the JavaScript function being called and wrap it in asetTimeout(() =&gt; { // Do the work here }, 0)this resolves nearly all the issues. We still get an application crash here and there but the `setTimeout` does the trick most of the time.This leads me to the following question. What's the proper way to call back to a TVJS application from native? Should I be using DispatchQueue.main.async { } instead of an OperationQueue? How does this relate to doing work on the main UI thread?Thanks!
4
0
1.9k
Dec ’21
Playing FairPlay streams with TVJS
Has anyone managed to play FairPlay streams using TVJS? According the MediaItem documentation three functions should be set as properties on the MediaItem for FairPlay streaming to work:loadCertificateloadAssetIDloadKeyIn our case all three functions are set but loadKey is never called. Our first suspicion was that we are not calling the callback in loadCertificate correctly - we have tried both calling it with a base64-encoded certificate (that's how we receive it from our server) and a decoded version but the result is the same in both cases - loadAssetID is called but never loadKey and playback never starts.Any more documentation or examples on how to play FairPlay streams using the TVJS Player would be greatly appreciated!Edit: this is the error we get:#T:[Main] #Error #SYSTEM : Error occurred: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x12fe76330 {Error Domain=NSOSStatusErrorDomain Code=-345003 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-345003), NSLocalizedDescription=The operation could not be completed}
18
0
5.8k
Dec ’21
TVML - Menu Bar disappears but I want it to stay
I have started with Apple's catalog sample project, and I am evolving several views to be completely driven by JSON (to the point where there isn't even a need for an XML file for that view anymore). I have everything working really well - the views do exactly what they should. There's just one problem - the menu bar disappears whenever the view gets presented.This occurs when I call navigationDocument.pushDocument, I suppose because it is pushing on top of the menu bar template. However when I switched to the setDocument function on the menu bar object, the view never appears at all.If I have a document ready to show based on what menu item the user picked, how do I display it without making the menu bar go away?
1
0
856
Jul ’21
How to Properly Integrate Google IMA SDK for Pre-roll, Mid-roll, and Post-roll Ads in a tvOS App using TVJS and Swift?
I'm working on a tvOS application that plays video content using TVMLKit/TVJS. I'm trying to integrate Google IMA SDK to show pre-roll, mid-roll, and post-roll ads in my app. Here’s what I’ve done so far: Video playback is handled through JavaScript in application.js. Ads are managed in Swift using Google IMA SDK. I use the evaluateJavaScript bridge to control video playback from Swift. I pause and resume the TVJS player (Player object) using a function like startPlayingVideo(value) from Swift based on the ad lifecycle. Current Flow: When the video is about to start, I call loadAds() from JS. This presents a Swift ViewController that handles IMA ad requests. On adsManagerDidRequestContentPause, I pause the video using JS via the bridge. On adsManagerDidRequestContentResume, I resume the video. The Issue: This setup doesn't behave consistently: Sometimes the ad plays in the background and video started playing as well but can not see the ad. Not able to see the post-roll ads Relevant Code Snippets: application.js function startPlayingVideo(value) { if (playerReference != undefined) { if (value == true) { playerReference.play(); else { playerReference.pause(); } } } function playVideo(videoURL) { setup playerReference, push mediaItem, etc. loadAds(); player.present(); } AppDelegate.swift let loadAds: @convention(block) () -\> Void = { DispatchQueue.main.async { let adManagerVC = ViewController() AppDelegate.tvController?.navigationController.present(adManagerVC, animated: true) } } let updateVideoPlayTime: @convention(block) (Double) -\> Void = { time in CustomContentPlayhead.shared.currentTime = TimeInterval(time) } ViewController.swift func adsManagerDidRequestContentPause(\_ adsManager: IMAAdsManager) { showAdUI() playerViewController.player?.pause() } func adsManagerDidRequestContentResume(\_ adsManager: IMAAdsManager) { hideAdUI() // Expecting JS video to resume via bridge } And yeah my IMSDK Implementation is working fine if I am using it with swift AVPlayer. What I Need Help With: Best practice for coordinating video playback between JS (Player) and Swift (IMAAdsManager). How can I sync the playhead reliably between JS and Swift? Is there a better way to pause/resume TVJS player from Swift during ad lifecycle? How to reliably insert mid-roll ads when the playback is primarily controlled in JS? Any insights, code examples, or recommended architecture improvements would be greatly appreciated!
Replies
0
Boosts
0
Views
186
Activity
Jun ’25
How to Display Multiple Fields in a User Registration Form Using TVML for Apple TV?
Hello, I am currently developing an application for Apple TV using TVML, and I am trying to create a user registration or login form with multiple input fields (e.g., "Username" and "Password"). However, I am facing issues with displaying multiple textField components in the formTemplate. Here are the approaches I have tried: Attempt 1: <document> <formTemplate> <banner> <title>Login</title> </banner> <banner> <textField>UserName</textField> </banner> <banner> <textField>Password</textField> </banner> <footer> <button id="button1"> <text>Button 1</text> </button> </footer> </formTemplate> </document> Attemp 2: <document> <formTemplate> <banner> <title>Login</title> </banner> <textField>UserName</textField> <textField>Password</textField> <footer> <button id="button1"> <text>Button 1</text> </button> </footer> </formTemplate> </document> In both cases, the layout does not render the fields as expected. Either the textField components do not display at all, or the structure seems incorrect. Could someone please guide me on the proper way to display multiple textField components in a formTemplate? Is there a limitation or specific requirement for structuring these elements? Thank you in advance for your assistance!
Replies
0
Boosts
0
Views
603
Activity
Jan ’25
I want to establish connection between iOS app and Apple TV via WIFI to develop apple tv remote app, Any one have idea how?
I'm looking to develop an iOS application that functions as a remote for Apple TV, including discovering Apple TV devices over Wi-Fi. If anyone has experience building similar applications, could you share insights on available frameworks or protocols to discover Apple TVs? Additionally, if there are reference apps on the App Store that work like Apple's default remote app, I would greatly appreciate recommendations. Any guidance from developers who have worked on similar projects would be very helpful!
Replies
1
Boosts
0
Views
534
Activity
Oct ’24
TVML web inspector stopped working?
Did anyone experience that the Safari/Safari Web Preview web inspector stopped working for TVML projects? In the past it was possible to browse DOM elements using that tool - at this moment it's always empty. If you have any hints to make it working again I would be glad to hear it, thx! tools stack Safari 16.6 macOS 13.5 (22G74) Xcode version 15.0 (15A240d)
Replies
0
Boosts
0
Views
728
Activity
Oct ’23
TVML apps cause memory leaks
Hi all ! I have been working a while in this issue , first i started instrumenting our product trying to remove all dependency that can be causing retain memory until the app source only contains the AppDelegate and the TVApplicationController delegates implementation loading the TVML App and the Javascript context. After that i just realise that any TVOS app using TVMLKit retain memory without cause and that eventually will provoque a CRASH exception because the device it will run outs memory. I realise that by implementing a Hello World TVML App and doing MemoryLeaks instrument measurements and is imposible to know where is the source of this memory retentions when the app start. ** For the folks of Apple Developer Technical Support (DTS) : ** Case ID : 3279774 Apple Feedback link : https://feedbackassistant.apple.com/feedback/12540693 Anyone else seeing this issue? We have all our customers impacted by this problem
Replies
0
Boosts
0
Views
737
Activity
Aug ’23
TVML Player JS start playing delay content behind the current LIVE timestamp
Hi all ! I have been working a while on this problem . Turns out some of our customers when playing LIVE HLS content through a TVML Application using the standard Player JS API , for some channels the content start playing 5 mins before live timestamp witch is an unexpected behavior using this Player API. As a developer , i took the channels customer content and implement 2 Sample tvOS Apps : By using Fairplay + AVPlayerController , all native implementation and the issue is not reproducible . By using FairPlay + Player JS API , a TVML Sample implementation and the issue i always reproducible. **For the folks of Apple Developer Technical Support (DTS) : ** Case ID : 3280424 Apple Feedback link : https://feedbackassistant.apple.com/feedback/12565232 Anyone else seeing this issue?
Replies
0
Boosts
0
Views
756
Activity
Aug ’23
TVML Basic and Technical Questions from TVML Rookie
Hi Guys, I did lot of iOS, tvOS and macOS developemnt with UIKit and SwiftUI, but TVML appears to have really steep learning curve. When searching online and in this forum, posts are 7 years old and most often there are no replies. Is TVML something already obsolete and abandoned by Apple? Does it make sense to try quickly building streaming app using TVML? Is it better to start in SwiftUI and build templates from scratch and forget about TVML? What's nice that I can quickly build a page with collections of videos, however I struggle for several hours to do the simplest thing like adding a simple element with title, subtitle and play button. Why this doesn't display anything inside stackTemplate? <banner> <stack> <title>My Title</title> </stack> </banner> Why this doesn't display anything inside stackTemplate? <collectionList> <shelf id="row0"> <section binding="items:{videos}"> <prototypes> <lockup prototype="play" videoURL="https://storage.googleapis.com/media-session/sintel/trailer.mp4" > <title style="margin: 20; color: white; font-size: 60" binding="textContent:{title}"/> </lockup> </prototypes> </section> </shelf> If I add image to the loclkup element, it works and displays image and title. But if I want to add only title and subtitle and play button, it doesn't work. Is img manadatory inside lockup element? In documentation I cannot find, which subelement is mandatory and which is optional. Why cannot I add stack element as a prototype into the section element? Although I'm a native developer and don't really like HTML, I thought that TVML works in a similar way and I can add almost any element into any other element, like building HTML and TVML platform will stack up UI elements based on that. However it appears to be severely limited. Rules for even a basic element inside another layout element are so strict that I cannot tell ahead if it's going to work. Why doesn't it at least display elements that are defined correctly? Usually when one of the elements is invalid, then the whole section or shelf or container in general is hidden from view. It's impossible to build UI from the ground up. For example I thought I could add lockup element with title, see how it looks, than add subtitle and continue adding elements one by one. However if lockup with title simply doesn't display at all, I cannot figure out what's wrong, there is no error message in the console. Documentation is insufficient, it's not possible to figure out from that how each TVML UI elements works, what's mandatory and what's optional, sometimes I was actually add element inside another element even though docs didn't say it's possible. Like adding stack to some element, which I no longer rememeber. Is it possible to debug TVML somehow? Is it possible to debug JS in Xcode? Is there any TVML preview like in case of xib or SwiftUI? So far I always have to rebuild the app and look in the simulator screen. But often it caches the results and I have to delete the app from simulator, clean the build and rebuild again. It's very time consuming. Is there nay way to clear the cache (hot key)? Thanks.
Replies
0
Boosts
1
Views
1.1k
Activity
Jul ’23
Cannot play videos on tvOS 16.
What is causing the problem with the app and how should I approach the solution? I have taken over the development of a video viewing application that runs on tvOS. Recently, a user reported that he could not play videos on tvOS 16. I built the application in xcode and tried to play the video on tvOS 16.4 in simulator. Then a symbol similar to 🚫 appeared on the video player and the video could not be played. UIKit and TVML Kit JS are used in the source code. Video source is HLS with H.264 codec When playback failed, Xcode displayed the following error message. 023-05-26 12:59:58.477905+0900 hoge_tvOS[35421:14197398] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x6000007080a0 H:|-(95)-[UIStackView:0x155247910] (active, names: '|':UIView:0x155247770 )>", "<NSLayoutConstraint:0x6000007082d0 UIStackView:0x155247910.trailing == UIView:0x155247770.trailing - 95 (active)>", "<NSLayoutConstraint:0x6000007f38e0 H:|-(0)-[UIView:0x155247770] (active, names: '|':_AVFocusContainerView:0x151d431f0 )>", "<NSLayoutConstraint:0x6000007f3930 UIView:0x155247770.trailing == _AVFocusContainerView:0x151d431f0.trailing (active)>", "<NSLayoutConstraint:0x60000070b1b0 '_UITemporaryLayoutWidth' _AVFocusContainerView:0x151d431f0.width == 0 (active)>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x6000007082d0 UIStackView:0x155247910.trailing == UIView:0x155247770.trailing - 95 (active)> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. I have confirmed in the past that it can be played on tvOS 14. Thanks for reading.
Replies
0
Boosts
3
Views
979
Activity
Jul ’23
SAP GUI 7.70 for JAVA Environment
Translated Report (Full Report Below)   Process:              SAPGUI [1388] Path:                 /Applications/SAP Clients/*/SAPGUI 7.70rev3.app/Contents/MacOS/SAPGUI Identifier:           com.sap.platin Version:              770.4.300 (770.4.300) Code Type:            X86-64 (Native) Parent Process:       launchd [1] User ID:              502   Date/Time:            2022-03-29 09:41:01.4338 +0100 OS Version:           macOS 12.3 (21E230) Report Version:       12 Anonymous UUID:       0EB8A533-EF4A-BF01-1D6B-A349CA5F2736     Time Awake Since Boot: 1800 seconds   System Integrity Protection: enabled   Crashed Thread:       42 Java: InvokeLaterDispatcher   Exception Type:       EXC_CRASH (SIGABRT) Exception Codes:      0x0000000000000000, 0x0000000000000000 Exception Note:       EXC_CORPSE_NOTIFY   Application Specific Information: abort() called   Model: MacBookPro14,1, BootROM 447.80.3.0.0, 2 processors, Dual-Core Intel Core i5, 2,3 GHz, 8 GB, SMC 2.43f11 Graphics: Intel Iris Plus Graphics 640, Intel Iris Plus Graphics 640, Built-In Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039 Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039 AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x170), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1710.3) AirPort: Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports Network Service: Wi-Fi, AirPort, en0 USB Device: USB30Bus Thunderbolt Bus: MacBook Pro, Apple Inc., 41.5
Replies
0
Boosts
0
Views
2.0k
Activity
Mar ’22
tvOS: Create a Search TVML Page with TVML SearchTemplate
This is the TVML SearchTemplate (taken from Apple's Docs: https://developer.apple.com/library/prerelease/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/SearchTemplate.html#//apple_ref/doc/uid/TP40015064-CH33-SW1var Template = function() { return `&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;document&gt; &lt;head&gt; &lt;style&gt; .suggestionListLayout { margin: -150 0; } &lt;/style&gt; &lt;/head&gt; &lt;searchTemplate id="tmpl_search"&gt; &lt;searchField/&gt; &lt;collectionList&gt; &lt;separator&gt;&lt;/separator&gt; &lt;/collectionList&gt; &lt;/searchTemplate&gt; &lt;/document&gt;` }It's something very basic.When the template is populated by some items it looks like the followingvar Template = function() { return `&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;document&gt; &lt;head&gt; &lt;style&gt; .suggestionListLayout { margin: -150 0; } &lt;/style&gt; &lt;/head&gt; &lt;searchTemplate&gt; &lt;searchField/&gt; &lt;collectionList&gt; &lt;shelf&gt; &lt;header&gt; &lt;title&gt;Shelf Title&lt;/title&gt; &lt;/header&gt; &lt;section&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/movies/movie_520_e1.lcr" width="350" height="520" /&gt; &lt;title&gt;Title 1&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/movies/movie_520_e2.lcr" width="350" height="520" /&gt; &lt;title&gt;Title 2&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/movies/movie_520_e3.lcr" width="350" height="520" /&gt; &lt;title&gt;Title 3&lt;/title&gt; &lt;/lockup&gt; &lt;/section&gt; &lt;/shelf&gt; &lt;grid&gt; &lt;header&gt; &lt;title&gt;Grid Title&lt;/title&gt; &lt;/header&gt; &lt;section&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/music/music_520_e1.lcr" width="350" height="350" /&gt; &lt;title&gt;Title 1&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/music/music_520_e2.lcr" width="350" height="350" /&gt; &lt;title&gt;Title 2&lt;/title&gt; &lt;/lockup&gt; &lt;lockup&gt; &lt;img src="${this.BASEURL}resources/images/music/music_520_e3.lcr" width="350" height="350" /&gt; &lt;title&gt;Title 3&lt;/title&gt; &lt;/lockup&gt; &lt;/section&gt; &lt;/grid&gt; &lt;/collectionList&gt; &lt;/searchTemplate&gt; &lt;/document&gt;` }Now, as soon as you name the template you should be able to get access to it in your Presenter code, that register events for the new Document:resourceLoader.loadResource(templateURL, function(resource) { if (resource) { var doc = self.makeDocument(resource); self.currentDOMDocument=doc // DOM Document "onload" event doc.addEventListener("load", self.dispatch.bind(self)); // DOM element "select" | "highlight" event doc.addEventListener("select", self.load.bind(self)); doc.addEventListener("highlight", self.load.bind(self)); if (self[presentation] instanceof Function) { self[presentation].call(self, doc, ele); } else { self.defaultPresenter.call(self, doc); } } } )So, in this case the event should be a "select" event on the search field:&lt;searchField/&gt;and so you will be able to get the featured i.e. the keyboard and to attach events for the input like:var formTemplate = ele.parentNode.parentNode; // your formTemplate button var children = formTemplate.childNodes; var textField = children.item(1); // replace "1" with the index of "textField" element in your template var keyboard = textField.getFeature("Keyboard"); // get the textField's Keyboard elementand the input textvar userValue = keyboard.text.replace(/-/g,""); // the value entered by the user on the Apple TV keyboardAt the "load" event you can attach events to get input changes like:var children = ele.childNodes; var textField = children.item(1); // replace "1" with the index of "textField" element in your template var keyboard = textField.getFeature("Keyboard"); // get the textField's Keyboard element keyboard.onTextChange = function () { console.log("onTextChange "+keyboard.text) if( keyboard.text.length &amp;&amp; !((keyboard.text.length+1) % 5) ) { // every 4 chars keyboard.text+='-'; } } }At this time you have the query string for your Search API.As soon as you get a callback from your API (that could make use of sayts - Search As You Type),we need to dynamically add items to the search results as new&lt;shelf/&gt;and inside a list of&lt;section&gt;&lt;lockup/&gt;&lt;/section&gt;lockup items. So how to dynamically add now these elements?
Replies
5
Boosts
0
Views
3.1k
Activity
Jan ’22
Proper way to call back into JavaScriptCore from native
In our tvOS app we have a couple of hooks into the native side where we receive events over a WebSocket in (using CocoaAsyncSocket) native and propagate those events into the JavaScript layer. The calls into the JS layer are structured like this:self.receiveQueue.addOperation { websocket.invokeMethod("onmessage", withArguments: [["data": text]]) }Where `receiveQueue` is an `OperationQueue`. This works great most of the time, but we occasionally see application crashes where it seems a memory reference has gone bad. However, we've found that if we take the JavaScript function being called and wrap it in asetTimeout(() =&gt; { // Do the work here }, 0)this resolves nearly all the issues. We still get an application crash here and there but the `setTimeout` does the trick most of the time.This leads me to the following question. What's the proper way to call back to a TVJS application from native? Should I be using DispatchQueue.main.async { } instead of an OperationQueue? How does this relate to doing work on the main UI thread?Thanks!
Replies
4
Boosts
0
Views
1.9k
Activity
Dec ’21
Playing FairPlay streams with TVJS
Has anyone managed to play FairPlay streams using TVJS? According the MediaItem documentation three functions should be set as properties on the MediaItem for FairPlay streaming to work:loadCertificateloadAssetIDloadKeyIn our case all three functions are set but loadKey is never called. Our first suspicion was that we are not calling the callback in loadCertificate correctly - we have tried both calling it with a base64-encoded certificate (that's how we receive it from our server) and a decoded version but the result is the same in both cases - loadAssetID is called but never loadKey and playback never starts.Any more documentation or examples on how to play FairPlay streams using the TVJS Player would be greatly appreciated!Edit: this is the error we get:#T:[Main] #Error #SYSTEM : Error occurred: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x12fe76330 {Error Domain=NSOSStatusErrorDomain Code=-345003 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-345003), NSLocalizedDescription=The operation could not be completed}
Replies
18
Boosts
0
Views
5.8k
Activity
Dec ’21
TVML - Menu Bar disappears but I want it to stay
I have started with Apple's catalog sample project, and I am evolving several views to be completely driven by JSON (to the point where there isn't even a need for an XML file for that view anymore). I have everything working really well - the views do exactly what they should. There's just one problem - the menu bar disappears whenever the view gets presented.This occurs when I call navigationDocument.pushDocument, I suppose because it is pushing on top of the menu bar template. However when I switched to the setDocument function on the menu bar object, the view never appears at all.If I have a document ready to show based on what menu item the user picked, how do I display it without making the menu bar go away?
Replies
1
Boosts
0
Views
856
Activity
Jul ’21