From c6dd0fb41564c8abd98d1c951ef2f58a0c190358 Mon Sep 17 00:00:00 2001 From: AJ Lauer Barinov Date: Fri, 10 May 2024 12:47:30 -0700 Subject: [PATCH] restart player when example menu options change --- .../SmartCacheExampleViewController.swift | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Examples/MuxPlayerSwiftExample/MuxPlayerSwiftExample/SmartCacheExampleViewController.swift b/Examples/MuxPlayerSwiftExample/MuxPlayerSwiftExample/SmartCacheExampleViewController.swift index 807018f..7a2c8d3 100644 --- a/Examples/MuxPlayerSwiftExample/MuxPlayerSwiftExample/SmartCacheExampleViewController.swift +++ b/Examples/MuxPlayerSwiftExample/MuxPlayerSwiftExample/SmartCacheExampleViewController.swift @@ -49,8 +49,31 @@ class SmartCacheExampleViewController: UIViewController { ProcessInfo.processInfo.playbackID ?? "qxb01i6T202018GFS02vp9RIe01icTcDCjVzQpmaB00CUisJ4" } - var smartCacheEnabled: Bool = true - var singleRenditionResolutionTier: SingleRenditionResolutionTier = .only720p + var smartCacheEnabled: Bool = true { + didSet { + playerViewController.prepare( + playbackID: playbackID, + playbackOptions: PlaybackOptions( + enableSmartCache: smartCacheEnabled, + singleRenditionResolutionTier: singleRenditionResolutionTier + ), + monitoringOptions: monitoringOptions + ) + } + } + + var singleRenditionResolutionTier: SingleRenditionResolutionTier = .only720p { + didSet { + playerViewController.prepare( + playbackID: playbackID, + playbackOptions: PlaybackOptions( + enableSmartCache: smartCacheEnabled, + singleRenditionResolutionTier: singleRenditionResolutionTier + ), + monitoringOptions: monitoringOptions + ) + } + } // MARK: Status Bar Appearance