Skip to content

Fix: Prevent premature video exit and improve playback handling - #22

Open
r-rmvg wants to merge 1 commit into
LetMeFly666:masterfrom
r-rmvg:master
Open

Fix: Prevent premature video exit and improve playback handling#22
r-rmvg wants to merge 1 commit into
LetMeFly666:masterfrom
r-rmvg:master

Conversation

@r-rmvg

@r-rmvg r-rmvg commented Jul 11, 2026

Copy link
Copy Markdown

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.

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.
@LetMeFly666

Copy link
Copy Markdown
Owner

Thanks for your contribution! And I may review and verify this in a few days.

@LetMeFly666 LetMeFly666 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread main.py
while True:
if driver.execute_script('return document.querySelector("#LetMeFly_Finished");'):
print('finished, wait 5s')
sleep(5) # 再让它播5秒

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-Coding is allowed, but unrelated changes should not be made.

Comment thread main.py
Comment on lines +316 to 321
print(f'正在播放视频 | 随机数防挂机: {random.random()}')
sleep(3)

return False


while finish1video():

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as last comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants