I'm trying to add Adobe Marketing Analytics to my app, I'm following these docs: https://marketing.adobe.com/resources/help/en_US/mobile/ios/apple_tv_implementation_tvos.html
My problem is that I cannot access ADBMobile in my JS files.
My app delegate looks like this:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, TVApplicationControllerDelegate {
var window: UIWindow?
var appController: TVApplicationController?
static let TVBaseURL = "http://xyz.com
static let TVBootURL = "\(AppDelegate.TVBaseURL)/js/application.js"
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
ADBMobile.collectLifecycleData()
window = UIWindow(frame: UIScreen.mainScreen().bounds)
let appControllerContext = TVApplicationControllerContext()
guard let javaScriptURL = NSURL(string: AppDelegate.TVBootURL) else {
fatalError("unable to create NSURL")
}
appControllerContext.javaScriptApplicationURL = javaScriptURL
appControllerContext.launchOptions["BASEURL"] = AppDelegate.TVBaseURL
appController = TVApplicationController(context: appControllerContext, window: window, delegate: self)
// This should add ADBMobile to my JSContext.
ADBMobile.installTVMLHooks(appController)
return true
}
}Then in my presenter.js I'm trying a really basic implementation:
...
load: function(event) {
...
if (videoURL) {
var sdkVersion = ADBMobile.version();
ADBMobile.trackActionData('videoPlayed', person);
console.log(sdkVersion);
var player = new Player();
var playlist = new Playlist();
var mediaItem = new MediaItem("video", videoURL);
player.playlist = playlist;
player.playlist.push(mediaItem);
setPlaybackEventListeners(player);
player.play();
}
....But all I get is the error: "Can't find variable: ADBMobile". What am I doing wrong?