Commit 19ca2f5
committed
fix(player): resolve shortcut pause failure caused by state oscillation (#174)
* fix(player): resolve shortcut pause failure caused by state oscillation
Remove problematic automatic retry mechanisms in PlayerOrchestrator that were causing infinite state oscillation loops between play and pause operations.
**Problem**:
- Shortcut pause commands (spacebar) would fail and immediately resume playback
- Logs showed repeating "Video element still playing after pause() call" warnings
- Root cause: setTimeout-based verification logic in requestPlay() and requestPause() created mutual triggering loops
**Solution**:
- Remove 150ms retry logic from requestPlay() (lines 283-297)
- Remove 50ms retry logic from requestPause() (lines 320-333)
- Remove verification timeouts from requestTogglePlay() (lines 345-360)
- Trust browser's native play()/pause() API reliability
**Impact**:
- ✅ Shortcut pause now works immediately without interference
- ✅ Eliminates state oscillation loop warnings from logs
- ✅ Mouse click controls remain unaffected
- ✅ All other player functionality preserved
Fixes #170
* test: update PlayerOrchestrator tests to reflect removed retry mechanisms
Update reliability tests that previously validated automatic retry behavior:
- 'should detect play failure in delayed verification' → 'should only call play once without retry'
- 'should detect pause failure in delayed verification' → 'should only call pause once without retry'
These tests now correctly validate the simplified behavior where play() and pause()
are called exactly once without automatic retry mechanisms, aligning with the fix
that removes state oscillation loops.
All 578 tests now pass ✅1 parent 09e98e2 commit 19ca2f5
2 files changed
Lines changed: 8 additions & 54 deletions
File tree
- src/renderer/src/pages/player/engine
- __tests__
Lines changed: 0 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | 281 | | |
299 | 282 | | |
300 | 283 | | |
| |||
333 | 316 | | |
334 | 317 | | |
335 | 318 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | 319 | | |
352 | 320 | | |
353 | 321 | | |
| |||
373 | 341 | | |
374 | 342 | | |
375 | 343 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | 344 | | |
384 | 345 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | 346 | | |
393 | 347 | | |
394 | 348 | | |
| |||
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
224 | | - | |
| 223 | + | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
249 | | - | |
| 248 | + | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
0 commit comments