kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, SwiftUI, support subtitles.
https://apps.apple.com/app/tracyplayer/id6450770064
GNU General Public License v3.0
980 stars 198 forks source link

Network Error State Not Triggered During Live Stream #736

Closed JulienDev closed 1 month ago

JulienDev commented 7 months ago

Describe the bug While testing network error handling on my Apple TV, I noticed that network errors (like disconnecting the internet) don't trigger expected error states or callbacks. After starting a live stream and then disconnecting the internet from my router, the Apple TV's state remains on buffering instead of changing to an error state. Additionally, the onFinish callback, which I expected to handle the error, is never called.

To Reproduce

  1. Start a live stream on Apple TV.
  2. After a few minutes, disconnect the internet connection for the Apple TV from the router.
  3. Wait and observe the behavior of the live stream.

Expected behavior The state changes to an error to reflect the lost connection. The onFinish callback is triggered to handle the error. Actual Outcome:

Actual behavior The state stays at buffering and doesn't change to an error state. The onFinish callback is not called at all.

Question Is there a different method to detect network errors in this scenario?

Platform (please complete the following information):

kingslay commented 7 months ago

因为我内部有加了网络错误自动重试的逻辑。所以没有回调onFinish方法。

JulienDev commented 7 months ago

Ah, okay. But when the internet connection is restored, streaming playback doesn't resume on my end. Is there a way to disable automatic retries so I can handle errors manually?

kingslay commented 7 months ago

是有开关可以把自动重试关掉的。但是这边还有一个问题点是: 为什么网络恢复了,不能继续播放。这个很奇怪。你的直播网络中断了多久呢?

JulienDev commented 7 months ago

I think I restored the connection after 2-3 minutes

kingslay commented 7 months ago

那你可以试下只中断30秒到70s。看下是不是能够恢复播放。看下是不是中断太久造成的。

JulienDev commented 7 months ago

After re-enabling the internet connection just a few seconds later, the video playback does not resume and remains halted.

kingslay commented 7 months ago

你可以看下TracyPlayer 会不会有这个问题

JulienDev commented 7 months ago

Same with TracyPlayer, even after re-enabling the internet connection, video playback never resume

kingslay commented 7 months ago

我这边试了下。我的app应该在网络断开一会儿之后 就可以显示播放失败。然后网络恢复之后 点播放按钮就可以继续播放了

JulienDev commented 7 months ago

On my Apple TV TracyPlayer is only showing a loader forever (tried for around 30 minutes)

kingslay commented 2 months ago

@JulienDev 你可以在用我的app试下。我刚修复了一个网络切换的问题

JulienDev commented 2 months ago

It's working perfectly with latest version of TracyPlayer on the Apple TV Store! What should I do to make it work in my app? Just update the KSPLayer lib?

kingslay commented 2 months ago

我的app用的是最新的lgpl分支的代码。你更新gpl版本的代码不一定可以。你可以试下。

JulienDev commented 2 months ago

Ok thanks. I think I'll wait for the next KSPlayer release then