public void CreateSessionTest() { if (!TestRuntime.CheckXcodeVersion(7, 0)) { Assert.Ignore("Ignoring AVAssetDownloadUrlSession tests: Requires iOS9+"); } if (Runtime.Arch == Arch.DEVICE) { Assert.Ignore("Ignoring CreateSessionTest tests: Requires com.apple.developer.media-asset-download entitlement"); } using (var backgroundConfiguration = NSUrlSessionConfiguration.CreateBackgroundSessionConfiguration("HLS-Identifier")) { Assert.DoesNotThrow(() => AVAssetDownloadUrlSession.CreateSession(backgroundConfiguration, null, NSOperationQueue.MainQueue), "Should not throw InvalidCastException"); } }
public void Setup() { var audioSession = AVAudioSession.SharedInstance(); var error = audioSession.SetCategory(AVAudioSessionCategory.Playback); if (error != null) { Log.Debug($"{error.LocalizedDescription}"); } else { var homeDirectory = NSHomeDirectoryNative(); baseDownloadURL = new NSUrl(homeDirectory); var backgroundConfiguration = NSUrlSessionConfiguration.CreateBackgroundSessionConfiguration("HLS-Identifier"); assetDownloadURLSession = AVAssetDownloadUrlSession.CreateSession(backgroundConfiguration, this, NSOperationQueue.MainQueue); } }