Skip to content

Commit

Permalink
fix(VideoPlayer): Rotation bug
Browse files Browse the repository at this point in the history
The video is duplicated when rotate={true} because filterView's frame referencet to playerLayout's

frame and not for bounds
  • Loading branch information
Shahen Hovhannisyan committed Mar 21, 2017
1 parent fe23d04 commit 0ec0a60
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ios/RNVideoProcessing/RNVideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ class RNVideoPlayer: RCTView {
override init(frame: CGRect) {
super.init(frame: frame)
playerLayer = AVPlayerLayer.init(player: player)
// self.layer.addSublayer(playerLayer!)
// playerLayer?.frame = self.bounds
// self.layer.needsDisplayOnBoundsChange = true
}

required init?(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -247,8 +244,9 @@ class RNVideoPlayer: RCTView {
filterView.bounds.size.height = self._playerHeight
}
filterView.frame.origin = CGPoint.zero
playerLayer?.frame = filterView.frame
self.filterView.transform = CGAffineTransform(rotationAngle: rotationAngle)
playerLayer?.frame = filterView.bounds
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
Expand Down Expand Up @@ -349,6 +347,7 @@ class RNVideoPlayer: RCTView {
playerLayer!.frame = filterView.bounds
playerLayer!.videoGravity = self._resizeMode
playerLayer!.masksToBounds = true
playerLayer!.removeFromSuperlayer()
filterView.layer.addSublayer(playerLayer!)

print("CHANGED playerframe \(playerLayer), frameAAA \(playerLayer?.frame)")
Expand Down

0 comments on commit 0ec0a60

Please sign in to comment.