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 97586e8

Browse files
update
1 parent 6073130 commit 97586e8

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

‎Sources/swiftui-loop-videoplayer/enum/VPErrors.swift‎

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,30 @@ public enum VPErrors: Error, CustomStringConvertible, Sendable {
2222
/// Error case for when settings are not unique.
2323
case settingsNotUnique
2424

25-
/// Picture-in-Picture (PiP) is not supported
25+
/// Picture-in-Picture (PiP) is not supported.
2626
case notSupportedPiP
2727

28-
/// Failed to load
29-
case failedToLoad
28+
/// Failed to load.
29+
/// - Parameter error: The error encountered during loading.
30+
case failedToLoad(Error?)
3031

3132
/// A description of the error, suitable for display.
3233
public var description: String {
3334
switch self {
34-
case .sourceNotFound(let name):
35-
return "Source not found: \(name)"
35+
case .sourceNotFound(let name):
36+
return "Source not found: \(name)"
3637

37-
case .notSupportedPiP:
38-
return "Picture-in-Picture (PiP) is not supported on this device."
38+
case .notSupportedPiP:
39+
return "Picture-in-Picture (PiP) is not supported on this device."
3940

40-
case .settingsNotUnique:
41-
return "Settings are not unique"
41+
case .settingsNotUnique:
42+
return "Settings are not unique."
4243

43-
case .remoteVideoError(let error):
44-
return "Playback error: \(String(describing:error?.localizedDescription))"
44+
case .remoteVideoError(let error):
45+
return "Playback error: \(error?.localizedDescription??"Unknown error.")"
4546

46-
case .failedToLoad:
47-
return "Failed to load the video."
47+
case .failedToLoad(let error):
48+
return "Failed to load the video: \(error?.localizedDescription ??"Unknown error.")"
4849
}
4950
}
5051
}
@@ -57,12 +58,19 @@ extension VPErrors: Equatable {
5758
switch (lhs, rhs) {
5859
case (.remoteVideoError(let a), .remoteVideoError(let b)):
5960
return a?.localizedDescription == b?.localizedDescription
61+
6062
case (.sourceNotFound(let a), .sourceNotFound(let b)):
6163
return a == b
64+
6265
case (.settingsNotUnique, .settingsNotUnique):
6366
return true
64-
case (.failedToLoad, .failedToLoad):
67+
68+
case (.notSupportedPiP, .notSupportedPiP):
6569
return true
70+
71+
case (.failedToLoad(let a), .failedToLoad(let b)):
72+
return a?.localizedDescription == b?.localizedDescription
73+
6674
default:
6775
return false
6876
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,12 @@ internal extension ExtPlayerProtocol {
230230
}
231231
case .failed:
232232
Task { @MainActor in
233-
self?.onError(.failedToLoad)
233+
let error = self?.currentItem?.error
234+
self?.onError(.failedToLoad(error))
234235
}
235236
@unknown default:
236237
Task { @MainActor in
237-
self?.onError(.failedToLoad)
238+
self?.onError(.failedToLoad(nil))
238239
}
239240
}
240241
}

0 commit comments

Comments
(0)

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