Skip to content

Commit

Permalink
weakself removed
Browse files Browse the repository at this point in the history
  • Loading branch information
KrishnaChaitanyaAmjuri committed Jul 20, 2019
1 parent 8e4baab commit 225a39b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Source/BMPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,15 @@ extension BMPlayer: BMPlayerLayerViewDelegate {
public func bmPlayer(player: BMPlayerLayerView, playerIsPlaying playing: Bool) {
controlView.playStateDidChange(isPlaying: playing)
weak var _self = self
delegate?.bmPlayer(player: _self!, playerIsPlaying: playing)
delegate?.bmPlayer(player: self, playerIsPlaying: playing)
playStateDidChange?(player.isPlaying)
}

public func bmPlayer(player: BMPlayerLayerView ,loadedTimeDidChange loadedDuration: TimeInterval , totalDuration: TimeInterval) {
BMPlayerManager.shared.log("loadedTimeDidChange - \(loadedDuration) - \(totalDuration)")
controlView.loadedTimeDidChange(loadedDuration: loadedDuration , totalDuration: totalDuration)
weak var _self = self
delegate?.bmPlayer(player: _self!, loadedTimeDidChange: loadedDuration, totalDuration: totalDuration)
delegate?.bmPlayer(player: self, loadedTimeDidChange: loadedDuration, totalDuration: totalDuration)
controlView.totalDuration = totalDuration
self.totalDuration = totalDuration
}
Expand Down Expand Up @@ -468,15 +468,15 @@ extension BMPlayer: BMPlayerLayerViewDelegate {
}
panGesture.isEnabled = state != .playedToTheEnd
weak var _self = self
delegate?.bmPlayer(player: _self!, playerStateDidChange: state)
delegate?.bmPlayer(player: self, playerStateDidChange: state)
}



public func bmPlayer(player: BMPlayerLayerView, playTimeDidChange currentTime: TimeInterval, totalTime: TimeInterval) {
BMPlayerManager.shared.log("playTimeDidChange - \(currentTime) - \(totalTime)")
weak var _self = self
delegate?.bmPlayer(player: _self!, playTimeDidChange: currentTime, totalTime: totalTime)
delegate?.bmPlayer(player: self, playTimeDidChange: currentTime, totalTime: totalTime)
self.currentPosition = currentTime
totalDuration = totalTime
if isSliderSliding {
Expand Down
10 changes: 5 additions & 5 deletions Source/BMPlayerControlView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ open class BMPlayerControlView: UIView {
}
}
weak var _self = self
delegate?.controlView(controlView: _self!, didPressButton: button)
delegate?.controlView(controlView: self, didPressButton: button)
}

/**
Expand All @@ -408,7 +408,7 @@ open class BMPlayerControlView: UIView {
// MARK: - handle UI slider actions
@objc func progressSliderTouchBegan(_ sender: UISlider) {
weak var _self = self
delegate?.controlView(controlView: _self!, slider: sender, onSliderEvent: .touchDown)
delegate?.controlView(controlView: self, slider: sender, onSliderEvent: .touchDown)
}

@objc func progressSliderValueChanged(_ sender: UISlider) {
Expand All @@ -417,13 +417,13 @@ open class BMPlayerControlView: UIView {
let currentTime = Double(sender.value) * totalDuration
currentTimeLabel.text = BMPlayer.formatSecondsToString(currentTime)
weak var _self = self
delegate?.controlView(controlView: _self!, slider: sender, onSliderEvent: .valueChanged)
delegate?.controlView(controlView: self, slider: sender, onSliderEvent: .valueChanged)
}

@objc func progressSliderTouchEnded(_ sender: UISlider) {
autoFadeOutControlViewWithAnimation()
weak var _self = self
delegate?.controlView(controlView: _self!, slider: sender, onSliderEvent: .touchUpInside)
delegate?.controlView(controlView: self, slider: sender, onSliderEvent: .touchUpInside)
}


Expand Down Expand Up @@ -451,7 +451,7 @@ open class BMPlayerControlView: UIView {
if selectedIndex != button.tag {
selectedIndex = button.tag
weak var _self = self
delegate?.controlView(controlView: _self!, didChooseDefition: button.tag)
delegate?.controlView(controlView: self, didChooseDefition: button.tag)
}
prepareChooseDefinitionView()
}
Expand Down
10 changes: 5 additions & 5 deletions Source/BMPlayerLayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ open class BMPlayerLayerView: UIView {
didSet {
if oldValue != isPlaying {
weak var _self = self
delegate?.bmPlayer(player: _self!, playerIsPlaying: isPlaying)
delegate?.bmPlayer(player: self, playerIsPlaying: isPlaying)
}
}
}
Expand All @@ -109,7 +109,7 @@ open class BMPlayerLayerView: UIView {
didSet {
if state != oldValue {
weak var _self = self
delegate?.bmPlayer(player: _self!, playerStateDidChange: state)
delegate?.bmPlayer(player: self, playerStateDidChange: state)
}
}
}
Expand Down Expand Up @@ -304,7 +304,7 @@ open class BMPlayerLayerView: UIView {
let currentTime = CMTimeGetSeconds(self.player!.currentTime())
let totalTime = TimeInterval(playerItem.duration.value) / TimeInterval(playerItem.duration.timescale)
weak var _self = self
delegate?.bmPlayer(player: _self!, playTimeDidChange: currentTime, totalTime: totalTime)
delegate?.bmPlayer(player: self, playTimeDidChange: currentTime, totalTime: totalTime)
}
updateStatus(inclodeLoading: true)
}
Expand Down Expand Up @@ -344,7 +344,7 @@ open class BMPlayerLayerView: UIView {
if state != .playedToTheEnd {
if let playerItem = playerItem {
weak var _self = self
delegate?.bmPlayer(player: _self!,
delegate?.bmPlayer(player: self,
playTimeDidChange: CMTimeGetSeconds(playerItem.duration),
totalTime: CMTimeGetSeconds(playerItem.duration))
}
Expand Down Expand Up @@ -385,7 +385,7 @@ open class BMPlayerLayerView: UIView {
let duration = item.duration
let totalDuration = CMTimeGetSeconds(duration)
weak var _self = self
delegate?.bmPlayer(player: _self!, loadedTimeDidChange: timeInterVarl, totalDuration: totalDuration)
delegate?.bmPlayer(player: self, loadedTimeDidChange: timeInterVarl, totalDuration: totalDuration)
}

case "playbackBufferEmpty":
Expand Down

0 comments on commit 225a39b

Please sign in to comment.