How to disable the Haptic Feedback when playing a Live Photo

258 views Asked by At

In my app, I allow the user to play Live Photos from their photo library.

To do this, I use the following:

@IBOutlet weak var livePhotoView: PHLivePhotoView!

@objc func handleTapGesture(_ recognizer: UITapGestureRecognizer) {
    if let currentType = currentMediaType {
        if currentType == .livePhoto && livePhotoIsPlaying == false {
            playImageView.alpha = 0
            backButtonView.alpha = 0
            ivePhotoView.startPlayback(with: .full)
            livePhotoIsPlaying = true
        } else if currentType == .livePhoto && livePhotoIsPlaying == true {
            livePhotoView.stopPlayback()
            livePhotoIsPlaying = false
        }
    }
}

By using this method, I get Haptic Feedback whenever the Live Photo is played which I don't want. Is this the normal behavior of PHLivePhotoView, and is there a way to disable it?

1

There are 1 answers

2
Stephen Thomas On

PHLivePhotoViews have an enum property called PHLivePhotoViewPlaybackStyle that determines if the playback should include haptic feedback.

To disable haptic feedback on playback use:

livePhotoView.startPlayback(with: .hint)

instead of:

livePhotoView.startPlayback(with: .full)