Skip to content

Commit

Permalink
fix: 修正直播播放失败时无限请求
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengchen committed Jun 30, 2024
1 parent 67df55d commit c82d30f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion BilibiliLive/Module/Live/LivePlayerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,18 @@ class LivePlayerViewModel {
}

func playerDidFailToPlay() {
retryCount += 1
Task {
do {
playInfos = Array(playInfos.dropFirst())
if playInfos.isEmpty {
retryCount += 1
if retryCount > 3 {
await MainActor.run {
onError?("播放失败")
}
return
}
try? await Task.sleep(nanoseconds: 1_000_000_000)
try await initPlayer()
return
} else {
Expand Down

0 comments on commit c82d30f

Please # to comment.