Fix: Prevent premature video exit and improve playback handling - #22
Fix: Prevent premature video exit and improve playback handling#22r-rmvg wants to merge 1 commit into
Conversation
Replaced sleep with WebDriverWait for element presence to avoid loading errors. Added a 5-second buffer logic in progress tracking to fix the instant-exit bug caused by timeline flutter. Added JavaScript injection to bypass video.pause and ensure video playback without interruptions. Fixed ElementNotInteractableException by using JS clicks and center scrolling.
|
Thanks for your contribution! And I may review and verify this in a few days. |
LetMeFly666
left a comment
There was a problem hiding this comment.
Great thanks for fixing the timeline flutter issue. The WebDriverWait and JS click changes look good.
However, I have concerns about overriding video.pause(). This changes native HTMLVideoElement behavior and may break player internal state management. I suggest removing this hook and relying on the existing video.paused -> play() recovery logic.
Also, please consider clearing the setInterval watcher after video completion to avoid accumulating timers.
The completion detection logic based on currentTime rollback may still have false positives when users seek. Checking against video.duration may be more robust.
| while True: | ||
| if driver.execute_script('return document.querySelector("#LetMeFly_Finished");'): | ||
| print('finished, wait 5s') | ||
| sleep(5) # 再让它播5秒 |
There was a problem hiding this comment.
AI-Coding is allowed, but unrelated changes should not be made.
| print(f'正在播放视频 | 随机数防挂机: {random.random()}') | ||
| sleep(3) | ||
|
|
||
| return False | ||
|
|
||
|
|
||
| while finish1video(): |
Replaced sleep with WebDriverWait for element presence to avoid loading errors.
Added a 5-second buffer logic in progress tracking to fix the instant-exit bug caused by timeline flutter.
Added JavaScript injection to bypass video.pause and ensure video playback without interruptions.
Fixed ElementNotInteractableException by using JS clicks and center scrolling.