Example #1
0
        public AssetPersistenceManager()
        {
            var backgroundConfiguration = NSUrlSessionConfiguration.BackgroundSessionConfiguration("AAPL-Identifier");

            assetDownloadUrlSession = AVAssetDownloadUrlSession.CreateSession(backgroundConfiguration, this, NSOperationQueue.MainQueue);
            activeDownloadsMap      = new Dictionary <AVAggregateAssetDownloadTask, Asset>();
            willDownloadToUrlMap    = new Dictionary <AVAggregateAssetDownloadTask, NSUrl>();
        }
Example #2
0
        public void CreateSessionTest()
        {
            if (!TestRuntime.CheckXcodeVersion(7, 0))
            {
                Assert.Ignore("Ignoring AVAssetDownloadUrlSession tests: Requires iOS9+");
            }

            TestRuntime.AssertNotDevice("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);
            }
        }