feat(app): add the playback core with look-ahead handover - #187
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M1 PR 10:播放核心的最小集(ADR 0018 的 M1 部分)。
做了什麼
PlaybackController:UI 唯一的播放入口,也是唯一會寫播放狀態的地方。Idle、Loading、Playing、Paused、Buffering、Retrying、Failed(AppError)。位置、時長、緩衝走獨立的 stream。AudioBackend介面與兩個實作:Android 用JustAudioBackend,Windows 用MediaKitBackend,由平台層宣告用哪一個和可播格式。backend_rules.dart:判斷一首是播完還是提前結束、前瞻清單怎麼改。這部分照搬舊專案。BackendSource交給後端,而它建構時就先過mediaRequestHeaders,沒有其他路徑能把 Cookie 交給播放引擎。QueueModel:只在記憶體、依序播放;StreamResolver:換候選一次,前瞻交接前檢查網址有沒有過期;RecoveryPolicy的 M1 部分:跳過,以及 1、3、9 秒的重試。--fmp-dev-playback:只在 dev 生效,用測試插件依序播三首,也能指定任意曲目鍵。PR 12 的播放列上線後刪掉。fmp_lints的fmp_layer_imports:just_audio、media_kit只准出現在後端目錄,並有雙向測試。驗證
dart analyze --fatal-infos、flutter analyze都零問題;flutter test600 個通過;fmp_lints兩種路徑模式都是 88/88;哨兵通過。integration_test/audio_backend_contract_test.dart,CI 不跑):dumpsys audio顯示整段只有一次requestAudioFocus,沒有abandonAudioFocus,換歌時不放音訊焦點。-no-audio啟動的,所以 Android 端沒有實際聽到聲音。Loading:just_audio 修改清單期間的 ready 事件被丟掉;dispose之後晚到的解析仍會開流;和計畫不同的地方
PlaybackSession出現時。implement.md,包括 release 版缺INTERNET權限(PR 13)、Unsupported的提示用語(PR 12)、前瞻開不起來的契約案例(M2)。Review 指南
lib/playback/backends/audio_backend.dart的 dartdoc:兩個引擎的差異都寫在那裡。playback_controller.dart的代與前瞻處理。_opening、_wantPlaying和_edit。