Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0b64413

Browse files
Update ExtPlayerProtocol.swift
1 parent 2e927af commit 0b64413

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎Sources/swiftui-loop-videoplayer/protocol/player/ExtPlayerProtocol.swift‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ internal extension ExtPlayerProtocol {
175175
currentSettings = settings
176176

177177
guard let newItem = createPlayerItem(with: settings) else{
178-
delegate?.didReceiveError(.sourceNotFound(settings.name))
178+
onError(.sourceNotFound(settings.name))
179179
return
180180
}
181181

@@ -189,6 +189,12 @@ internal extension ExtPlayerProtocol {
189189
play()
190190
}
191191
}
192+
193+
/// Handles errors
194+
/// - Parameter error: An instance of `VPErrors` representing the error to be handled.
195+
private func onError(_ error : VPErrors){
196+
delegate?.didReceiveError(error)
197+
}
192198

193199
/// Sets up observers on the player item and the player to track their status and error states.
194200
///
@@ -199,7 +205,7 @@ internal extension ExtPlayerProtocol {
199205
errorObserver = player.observe(\.error, options: [.new]) { [weak self] player, _ in
200206
guard let error = player.error else { return }
201207
Task { @MainActor in
202-
self?.delegate?.didReceiveError(.remoteVideoError(error))
208+
self?.onError(.remoteVideoError(error))
203209
}
204210
}
205211

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /