tvml

Uglification failed. Unexpected character '`'

一个人想着一个人 提交于 2020-01-22 14:16:44
问题 gulp-uglify is unable to uglify this piece of code: var alertString = `<?xml version="1.0" encoding="UTF-8" ?> <document> <alertTemplate> <title>${title}</title> <description>${description}</description> </alertTemplate> </document>` it complains at the character: `. The character is valid for the apple's JS framework. I can't see anything inside the uglify package to ignore those characters and the text string inside it. Am i missing something from the documentation? 回答1: Gulp-uglify has yet

TVML - how to modify formTemplate to show “pin entry”

别说谁变了你拦得住时间么 提交于 2020-01-17 13:57:07
问题 TVML's formTemplate can easily be adapted to only allow numeric input: <formTemplate> <textField keyboardType="numberPad">0000</textField> <footer> <button> <text>${TEXT("Submit")}</text> </button> </footer> </formTemplate> This gives a page like... I would like to reduce it even further to only display a "pin entry" screen as shown here: Is this possible with TVML, without hosting an own UIControl? I have nowhere found any mentioning of changing styles like this. Any idea how to achieve this

TVML-document in Swift tvOS project

末鹿安然 提交于 2020-01-17 01:24:07
问题 I have a project written in Swift for tvOS . Now I found a great TVML-document that I want to add in my project. Tell me please if there are any possible ways to do it? Can I use TVML-document as a base for UIViewController ? 回答1: I found a very nice framework that can help me to embed TVML-documents in tvOS application written in swift. Here is it https://github.com/toshi0383/TVMLKitchen. It has everything that I need to solve my problem and it also easy-to-use and install. I hope that it

Set font family in TVML

帅比萌擦擦* 提交于 2019-12-30 11:20:07
问题 In my TVML app I am able to set font style properties such as font-size and font-weight using tv-text-style:none, however I am not able to set the font-family property, which seems to be ignored: var Template = function() { return `<?xml version="1.0" encoding="UTF-8" ?> <document> <head> <style> .customText { tv-text-style: none; tv-position: center; color: white; font-size: 40px; font-weight: bold; font-family: Courier; } </style> </head> <paradeTemplate> ... <listItemLockup> <title>Title<

Can I mix UIKit and TVMLKit within one app?

≡放荡痞女 提交于 2019-12-28 03:38:05
问题 I'm exploring tvOS and I found that Apple offers nice set of templates written using TVML . I'd like to know if a tvOS app that utilises TVML templates can also use UIKit . Can I mix UIKit and TVMLKit within one app? I found a thread on Apple Developer Forum but it does not fully answer this question and I am going through documentation to find an answer. 回答1: Yes, you can. Displaying TVML templates requires you to use an object that controls the JavaScript Context: TVApplicationController .

Force view to reload tvml content on Apple TV/tvos

霸气de小男生 提交于 2019-12-23 15:49:34
问题 I have been working on dynamically generating tvml-templates with very frequently changing content for a tvOS app on Apple TV. Generating the templates works fine, however I have not been able to get the app to update/reload the content of a template when navigating back and forth between views or leaving and reentering the app. Only rebooting seems to reload the tvml template. 回答1: Your template will refresh itself automatically whenever you manipulate the TVML within the template document.

Generate the Dominant Colors for an RGB image with XMLHttpRequest

◇◆丶佛笑我妖孽 提交于 2019-12-21 04:42:36
问题 A Note For Readers: This is a long question, but it needs a background to understand the question asked. The color quantization technique is commonly used to get the dominant colors of an image. One of the well-known libraries that do color quantization is Leptonica through the Modified Median Cut Quantization (MMCQ) and octree quantization (OQ) Github's Color-thief by @lokesh is a very simple implementation in JavaScript of the MMCQ algorithm: var colorThief = new ColorThief(); colorThief

Call Swift code from an Apple TV TVML TVJS JavaScript App

不打扰是莪最后的温柔 提交于 2019-12-13 06:12:36
问题 I have a basic TVML application set up. Currently simple events (such as a button press) are handled via JavaScript (TVJS). When the user presses a button (provided via TVML template) I'd like some code to run in Swift instead, that manipulates UI elements. What's the best way to do this? 回答1: You can use evaluateAppJavaScriptIn method in TVApplicationControllerDelegate as below and write corresponding swift method in it; (swift side) // MARK: TVApplicationControllerDelegate func

Line Wrap description text in a compilationTemplate's relatedContent area in TVML

流过昼夜 提交于 2019-12-13 01:13:58
问题 How can I wrap the description text in the relatedContent area of a compilationTemplate ? My description tag: <description style="tv-text-style: none; font-size:36; font-weight:regular; word-wrap:break-word;">lorem ipsum dolor sit amet consectetur adipiscing elit</description> Full template: var Template = function() { return `<?xml version="1.0" encoding="UTF-8" ?> <document> <compilationTemplate theme="light"> <list> <relatedContent> <itemBanner> <heroImg src="${this.BASEURL}images/shows

Pass variable from Swift to javascript function

自闭症网瘾萝莉.ら 提交于 2019-12-11 11:53:25
问题 Having trouble using JSContext to pass a variable to a javascript function. The error says stringToSend is undefined: func sendSomething(stringToSend : String) { appController?.evaluateInJavaScriptContext({ (context) -> Void in context.evaluateScript("myJSFunction(stringToSend)") }, completion: { (evaluated) -> Void in print("we have completed: \(evaluated)") }) } 回答1: Here is how I like to communicate from Swift to Javascript: func sendSomething(stringToSend : String) { appController?