Closed pdiazmon closed 3 years ago
Adding the following to appDelegate.swift should fix the error.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(.playback, mode: .moviePlayback)
}
catch {
print("Setting category to AVAudioSessionCategoryPlayback failed.")
}
return true
}
When I try to play a Youtube video in my tvOS app (within the simulator) I get the following error:
[MediaRemote] [MRPlaybackQueueServiceClient] playbackQueueRequest 2E591177-D3D8-4CE8-A18F-FCF83FDA992E PineBoard-21384 /A600.000000x600.000000/R[0:1] responded to asset request with error Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=15 "Operation requires a client data source to have been registered." UserInfo={NSLocalizedDescription=Operation requires a client data source to have been registered.}
I've set the api key in the YouTubeService object. And everything runs well until the AVPlayerViewController.player.play() method is called.
I have run the tvOS demo and I get the same error.