Don’t play GIFs in timelines if “Reduce Motion” is enabled

This commit is contained in:
Jed Fox 2022-12-23 17:05:42 -05:00
parent 3b3f870caa
commit 6bf5f94169
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
1 changed files with 13 additions and 1 deletions

View File

@ -191,7 +191,19 @@ extension MediaView {
playerViewController.showsPlaybackControls = false
// auto play for GIF
player.play()
if !UIAccessibility.isReduceMotionEnabled {
player.play()
}
NotificationCenter.default
.publisher(for: UIAccessibility.reduceMotionStatusDidChangeNotification)
.sink { _ in
if UIAccessibility.isReduceMotionEnabled {
player.pause()
} else {
player.play()
}
}
.store(in: &_disposeBag)
bindAlt(configuration: configuration, altDescription: info.altDescription)
}