Skip to content

Commit

Permalink
chore: removed useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
forgotvas committed Feb 5, 2024
1 parent 6026d15 commit 75c956a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Course/Course/Presentation/Video/PlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ struct PlayerViewController: UIViewControllerRepresentable {
}

func updateUIViewController(_ playerController: AVPlayerViewController, context: Context) {
DispatchQueue.main.async {
let asset = playerController.player?.currentItem?.asset as? AVURLAsset
if asset?.url.absoluteString != videoURL?.absoluteString {
let player = context.coordinator.player(from: playerController)
player?.replaceCurrentItem(with: AVPlayerItem(url: videoURL!))
player?.currentItem?.preferredMaximumResolution = videoResolution

context.coordinator.setPlayer(player) { progress, seconds in
self.progress(progress)
self.seconds(seconds)
}
let asset = playerController.player?.currentItem?.asset as? AVURLAsset
if asset?.url.absoluteString != videoURL?.absoluteString {
let player = context.coordinator.player(from: playerController)
player?.replaceCurrentItem(with: AVPlayerItem(url: videoURL!))
player?.currentItem?.preferredMaximumResolution = videoResolution

context.coordinator.setPlayer(player) { progress, seconds in
self.progress(progress)
self.seconds(seconds)
}
}
}
Expand Down

0 comments on commit 75c956a

Please sign in to comment.