feat: free mode random walk + pause wake lock release

State machine (张明远):
- Add select_random_free_state() for FreeMode states without
  next_state/next_states config
- Weighted random selection across all FreeMode states
- Matches old hologram_player_rust behavior

Video plugin (赵雨薇):
- Send ScreenLockRequest(false) to screen plugin on Pause
- Send ScreenLockRequest(true) to screen plugin on Play/Resume
- Closes the pause-wake-lock gap vs old version

cargo check: 0 warnings, cargo test: 22/22 passed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
showen
2026-03-12 12:56:45 +08:00
parent b3cf12359e
commit cc4d6935d9
2 changed files with 131 additions and 1 deletions

View File

@@ -147,9 +147,25 @@ impl Plugin for VideoPlugin {
match command {
PlayerCommand::Play => {
processor.play()?;
// 恢复播放时重新获取防息屏锁
if let Some(ctx) = &self.ctx {
let _ = ctx.tx.send(Envelope {
from: self.id(),
to: Destination::Plugin("screen"),
message: Message::ScreenLockRequest(true),
});
}
}
PlayerCommand::Pause => {
processor.pause();
// 暂停时释放防息屏锁
if let Some(ctx) = &self.ctx {
let _ = ctx.tx.send(Envelope {
from: self.id(),
to: Destination::Plugin("screen"),
message: Message::ScreenLockRequest(false),
});
}
}
PlayerCommand::Next => {
processor.next_video()?;