tvml

How to retrieve values from settings.bundle in TVML?

坚强是说给别人听的谎言 提交于 2019-12-11 11:18:10
问题 In my tvOS app I created a settings bundle, but I don't know how to get the values in TVML. I know how to do it in Obj-c or Swift. var standardUserDefaults = NSUserDefaults.standardUserDefaults() var us: AnyObject? = standardUserDefaults.objectForKey("your_preference") if us==nil { self.registerDefaultsFromSettingsBundle(); } Any ideas about TVML way? Any kind of help is highly appreciated. 回答1: I am not aware of a direct TVJS access method... but you could easily set up a Swift/Obj-C-"proxy"

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

How to get the node and keyboard reference of TVML textField in TVJS?

為{幸葍}努か 提交于 2019-12-08 07:22:54
问题 Someone asked the same question here How do you get the value from a TVML textField? but didn't explain the full answer and my comment there was edited, suggesting me to ask a brand new question. Here it is... Can anyone help understand how to best get a reference to the textField node and its keyboard value from TVML? Right now I'm using this code below in Presenter.js to get to the textField once the user clicks the Done button in the template displaying the form & keyboard, but still get

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:

Uglification failed. Unexpected character '`'

狂风中的少年 提交于 2019-12-03 14:19:24
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? Gulp-uglify has yet no official support for ECMAScript 2015 (aka ES6, aka Harmony) but with a little modification the on

Set font family in TVML

為{幸葍}努か 提交于 2019-12-01 11:36:21
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</title> <relatedContent> <divTemplate> <title class="customText">abcABC</title> </divTemplate> <

Can I mix UIKit and TVMLKit within one app?

左心房为你撑大大i 提交于 2019-11-27 11:50:40
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. Yes, you can. Displaying TVML templates requires you to use an object that controls the JavaScript Context: TVApplicationController . var appController: TVApplicationController? This object has a UINavigationController property associated