Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
swiftuiux committed Aug 14, 2024
1 parent d48dc08 commit 52d55d3
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public protocol LoopingPlayerProtocol: AbstractPlayer, LayerMakerProtocol{
/// - player: The AVQueuePlayer to observe for errors.
func setupObservers(for item: AVPlayerItem, player: AVQueuePlayer)

/// Responds to changes in the playback status of an AVPlayerItem.
///
/// - Parameter item: The AVPlayerItem whose status changed.
func handlePlayerItemStatusChange(_ item: AVPlayerItem)

/// Responds to errors reported by the AVQueuePlayer.
///
/// - Parameter player: The AVQueuePlayer that encountered an error.
Expand Down Expand Up @@ -171,17 +166,6 @@ internal extension LoopingPlayerProtocol {
errorObserver = nil
}


/// Responds to changes in the status of an AVPlayerItem.
///
/// This method checks if the status of the AVPlayerItem indicates a failure.
/// If a failure occurs, it notifies the delegate about the error.
/// - Parameter item: The AVPlayerItem whose status has changed to be evaluated.
func handlePlayerItemStatusChange(_ item: AVPlayerItem) {
guard item.status == .failed, let error = item.error else { return }
delegate?.didReceiveError(.remoteVideoError(error))
}

/// Responds to errors reported by the AVPlayer.
///
/// If an error is present, this method notifies the delegate of the encountered error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ class LoopingPlayerUIView: UIView, LoopingPlayerProtocol {
/// The queue player that plays the video items.
internal var player: AVQueuePlayer?

/// Observer for the status of the AVPlayerItem.
internal var statusObserver: NSKeyValueObservation?

/// Observer for errors from the AVQueuePlayer.
internal var errorObserver: NSKeyValueObservation?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import AppKit
/// This class handles the initialization and management of a looping video player with customizable video gravity.
@available(macOS 11.0, *)
@MainActor @preconcurrency
class LoopingPlayerNSView: NSView, LoopingPlayerProtocol {
class LoopingPlayerNSView: NSView, LoopingPlayerProtocol {

/// `filters` is an array that stores CIFilter objects used to apply different image processing effects
internal var filters: [CIFilter] = []
Expand All @@ -40,9 +40,6 @@ class LoopingPlayerNSView: NSView, LoopingPlayerProtocol {
/// The queue player that plays the video items.
internal var player: AVQueuePlayer?

/// Observer for the status of the AVPlayerItem.
internal var statusObserver: NSKeyValueObservation?

/// Observer for errors from the AVQueuePlayer.
internal var errorObserver: NSKeyValueObservation?

Expand Down

0 comments on commit 52d55d3

Please sign in to comment.