Skip to content

Commit

Permalink
Merge pull request #746 from sedenkovvlad/bug/duplication-video
Browse files Browse the repository at this point in the history
Fixed a bug with video duplication when cropping
  • Loading branch information
NikKovIos authored May 25, 2022
2 parents 3d37d04 + bfa9045 commit f335418
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Source/Filters/Video/YPVideoFiltersVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public final class YPVideoFiltersVC: UIViewController, IsMediaFilterVC {
.addObserver(self,
selector: #selector(itemDidFinishPlaying(_:)),
name: .AVPlayerItemDidPlayToEndTime,
object: nil)
object: videoView.player.currentItem)

// Set initial video cover
imageGenerator = AVAssetImageGenerator(asset: self.inputAsset)
Expand Down
7 changes: 2 additions & 5 deletions Source/Filters/Video/YPVideoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public class YPVideoView: UIView {
singleTapGR.numberOfTapsRequired = 1
addGestureRecognizer(singleTapGR)

// Loop playback
addReachEndObserver()

playerView.alpha = 0
playImageView.alpha = 0.8
playerLayer.videoGravity = .resizeAspect
Expand Down Expand Up @@ -153,13 +150,13 @@ extension YPVideoView {
NotificationCenter.default.addObserver(self,
selector: #selector(playerItemDidReachEnd(_:)),
name: .AVPlayerItemDidPlayToEndTime,
object: nil)
object: player.currentItem)
}

/// Removes the observer for AVPlayerItemDidPlayToEndTime. Could be needed to implement own observer
public func removeReachEndObserver() {
NotificationCenter.default.removeObserver(self,
name: .AVPlayerItemDidPlayToEndTime,
object: nil)
object: player.currentItem)
}
}

0 comments on commit f335418

Please sign in to comment.