4

I need to loop a video in an Apple TV app, and I really would prefer to use TVJS so that we can update easily server side. However, when I loop the video, it shows the playback controls every time, and this is not ideal.

I see that AVPlayerViewController has a showsPlaybackControls bool that can be set to false, and is true by default, but the TVJS Player Class does not seem to have the same available to it.

What I am curious about is if there is a way that from the AppDelegate I can change that default from true to false so that the playbackControls never ever show? I have included my AppDelegate as well below. Thanks in advance!

import UIKit
import TVMLKit
import AVFoundation

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, TVApplicationControllerDelegate {

    var window: UIWindow?

    var appController: TVApplicationController?
    static let TVBaseURL = "http://localhost:3000/"
    static let TVBootURL = "\(AppDelegate.TVBaseURL)assets/tv.js"


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        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)
        return true
    }

}
Ben Simmons
  • 230
  • 1
  • 13

0 Answers0