diff --git a/Tusker/Views/Attachments/GifvController.swift b/Tusker/Views/Attachments/GifvController.swift index 61ef74ee..b6e01f08 100644 --- a/Tusker/Views/Attachments/GifvController.swift +++ b/Tusker/Views/Attachments/GifvController.swift @@ -62,10 +62,14 @@ class GifvController { @objc private func preferencesChanged() { if isGrayscale != Preferences.shared.grayscaleImages { isGrayscale = Preferences.shared.grayscaleImages + let oldItem = item item = GifvController.createItem(asset: asset) player.replaceCurrentItem(with: item) self.updatePresentationSizeObservation() player.play() + + NotificationCenter.default.removeObserver(self, name: AVPlayerItem.didPlayToEndTimeNotification, object: oldItem) + NotificationCenter.default.addObserver(self, selector: #selector(restartItem), name: AVPlayerItem.didPlayToEndTimeNotification, object: item) } }