Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page not destroyed when window closed #1235

Closed
forceflow1049 opened this issue Oct 15, 2023 · 1 comment
Closed

Page not destroyed when window closed #1235

forceflow1049 opened this issue Oct 15, 2023 · 1 comment

Comments

@forceflow1049
Copy link

Specification

  • pywebview version: 4.3.3
  • operating system: macOS 13.4
  • web renderer: Webkit

Description

When multiple windows are open, closing one doesn't seem to actually destroy the page or stop code execution. Here's a minimal working example:

page1.html

<html>
    <body>
        <video src="input.mp4" autoplay loop></video>
    </body>
</html>

input.mp4 should be a video with sound.

page2.html

<html>
    <body>
        Page 2
    </body>
</html>

Start a web server to serve the pages:
python3 -m http.server

Python:

import webview

window1 = webview.create_window('Page 1', url='http://localhost:8000/page1.html')
window2 = webview.create_window('Page 2', url='http://localhost:8000/page2.html')

webview.start()

Run the script and close Page 1 (the one with the video).

Expected behavior: the page is destroyed and the video stops playing.
Actual behavior: the video continues to play (you can still hear the audio).

@r0x0r
Copy link
Owner

r0x0r commented Oct 16, 2023

This seems to be a bug in WKWebView, as video keeps playing even after explicitly setting webkit reference to None. https://stackoverflow.com/questions/27410413/wkwebview-embed-video-keeps-playing-sound-after-release

A rather ghetto workaround is to load empty html just before closing window. I have pushed it to master.

@r0x0r r0x0r closed this as completed Oct 27, 2023
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

No branches or pull requests

2 participants