tvjs

Manually setting focus to a <lockup> element in TVJS

為{幸葍}努か 提交于 2020-01-25 12:25:27
问题 I can't find any method in the Documentation to manually set the focus to an element. It is supposed to support the DOM Element class, but when i do var elem = ele.ownerDocument.getElementById("start"); elem.focus(); it does nothing. elem is correctly set, but it doesn't recognize the focus() method. 回答1: Apple's TVJS Framework doesn't provide any method in his classes to manually focus an element. Neither in the standard Document Object Module classes it incorporates have any kind of method

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

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?

send a cookie with XMLHTTPRequest (TVMLJS)

旧巷老猫 提交于 2019-12-10 16:38:13
问题 I am developing an application for my AppleTV. The App will read movies from an online website that hasn't developed any API for this kind of thing. I use XMLHTTPRequest to get the different URLs and have the user search for his movie, etc... Everything is working fine, except for a single request. To get the movie URL, I have to send a get request to a specific address (let's say http://example.com/getmovie.html) with a constant cookie (let's say mycookie=cookie). I've tried using

Can you host TVJS files on the Apple TV instead of an external server?

淺唱寂寞╮ 提交于 2019-12-07 08:09:36
问题 I've downloaded the TVMLCatalog application from Apple. The code is split up into 2 parts. client - this holds the TVML and TVJS files TVMLCatalog Project - this is the basic Xcode project that sets up the TVML/TVJS I'm attempting to host the client TVJS files in the same bundle as the TVMLCatalog Project . I've changed the AppDelegate didFinishLaunching as follows: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { //

Can you host TVJS files on the Apple TV instead of an external server?

烂漫一生 提交于 2019-12-05 13:25:02
I've downloaded the TVMLCatalog application from Apple. The code is split up into 2 parts. client - this holds the TVML and TVJS files TVMLCatalog Project - this is the basic Xcode project that sets up the TVML/TVJS I'm attempting to host the client TVJS files in the same bundle as the TVMLCatalog Project . I've changed the AppDelegate didFinishLaunching as follows: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. window = UIWindow(frame: UIScreen.mainScreen(

Generate the Dominant Colors for an RGB image with XMLHttpRequest

好久不见. 提交于 2019-12-03 14:40:12
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.getColor(sourceImage); Technically, the image on a <img/> HTML element is backed on a <canvas/> element: