Fix changing greyscale images preference breaking gifvs looping
This commit is contained in:
parent
f0ec372f50
commit
08bd78d51b
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue