Skip to content

Fix data usage: avoid prebuffer & auto-retry before user plays - #243

Open
Ritanlisa wants to merge 311 commits into
jay3-yy:mainfrom
Ritanlisa:fix/network-retry-data-usage
Open

Fix data usage: avoid prebuffer & auto-retry before user plays#243
Ritanlisa wants to merge 311 commits into
jay3-yy:mainfrom
Ritanlisa:fix/network-retry-data-usage

Conversation

@Ritanlisa

Copy link
Copy Markdown

Summary\n- Stop pre-buffering (player.prepare) when click-to-play disables autoplay, reducing unintended mobile data usage.\n- Skip automatic retry/CDN switching until the user has explicitly started playback, preventing repeated re-loads under flaky networks.\n\n## Test plan\n- [ ] Manual: open a video with click-to-play enabled; verify no network buffering until user taps Play.\n- [ ] Manual: simulate network errors before tapping Play; verify we don't auto switch CDN/retry.\n

- Update versionCode to 45, versionName to 4.3.3
- Fix false network error by restoring cached UI state when reusing player
- Improve media controls and background playback handling
…in Space Screen

- Added 'Unfavorite' (Cancel Collection) feature in 'My Favorites' screen.
- Added direct 'Heart Slash' button with confirmation dialog for unfavoriting.
- Fixed 'FavoriteData' mapping to ensure correct 'aid' for removal.
- Added 'Follow/Unfollow' button in UP Space Screen header.
- Implemented 'batchDelFavResource' and 'modifyRelation' APIs.
- Added optimistic UI updates for both features.
1. 修复 StoryVideoCard 长按预览失效问题\n2. 修复 VideoPlayerSection 拦截预测性返回手势的问题\n3. 移除 VideoPreviewDialog 共享元素过渡,回归标准动画\n4. 移除着陆震动反馈,恢复阻尼系数
Fix tablet indicator misalignment, skeleton loading issues, and slide-to-sidebar feature.
1. 移除无关项目文件夹和日志\n2. 优化 build.gradle.kts,使 google-services.json 可选\n3. 更新 README.md,补充新功能说明与版本号
- 移除 DampedDragAnimationState,使用 PagerState 作为唯一状态源
- 优化 SimpleLiquidIndicator 样式(更扁长、垂直居中)
- 修复滑动到追番分类时不加载数据的问题
Copilot AI review requested due to automatic review settings April 25, 2026 13:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts playback initialization and error recovery behavior to avoid unintended network usage when autoplay is disabled (click-to-play), and to prevent automatic retry/CDN switching before the user initiates playback.

Changes:

  • Gate player.prepare() on playWhenReady to avoid prebuffering when autoplay is off.
  • Skip auto-retry/CDN switching on player errors until playback has been started by user intent.
  • Expose a ViewModel flag (hasUserStartedPlayback) for recovery decisions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
app/src/main/java/com/android/purebilibili/feature/video/viewmodel/PlayerViewModel.kt Exposes internal getter for “user started playback” flag used by recovery logic.
app/src/main/java/com/android/purebilibili/feature/video/usecase/VideoPlaybackUseCase.kt Stops preparing the player on load when playWhenReady is false.
app/src/main/java/com/android/purebilibili/feature/video/state/VideoPlayerState.kt Adds guard to skip automatic recovery actions until user has started playback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"VideoPlayerState",
"🛑 Skip auto recovery: user hasn't started playback (playWhenReady=${player.playWhenReady}, isPlaying=${player.isPlaying})"
)
holder.recordDiagnosticEvent("skipAutoRecovery:userNotStarted")

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the early-return path that skips auto recovery, the retry/CDN switch counters are left unchanged. Because retryCountRef is remember { ... } (not keyed by bvid/cid), those counters can carry over from a previous video/session and later cause the first user-initiated playback error to immediately hit the retry budget. Consider resetting retryCountRef.count and retryCountRef.cdnSwitchCount before returning when auto recovery is skipped (or otherwise resetting them when entering a new manual-play session).

Suggested change
holder.recordDiagnosticEvent("skipAutoRecovery:userNotStarted")
holder.recordDiagnosticEvent("skipAutoRecovery:userNotStarted")
retryCountRef.count = 0
retryCountRef.cdnSwitchCount = 0

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants