Files
Velix-MPV-Core/DOCS/PLAYER_LIFECYCLE.md
T

740 B

Player lifecycle

产品调用顺序:

create → attachSurface → prepare(source) → play
  ↘ pause / seekTo / seekBy / tracks / subtitles
stop → prepare 或 release
detachSurface → release

onForeground、onBackground、onSurfaceAvailable、onSurfaceDestroyed 是显式适配接口。当前后台策略只释放/暂停 Surface 相关资源,不承诺后台播放、PiP 或通知栏控制。Surface 与 player 生命周期解耦:Surface 销毁不会自动销毁 Core player,新的 Surface 可重新 attach。

页面状态以 500ms 轮询读取,错误通过 errorCode 与 lastError 映射到 UI;首帧、缓冲、seek、音频与 renderer 指标仅在“显示调试统计”打开时显示。