Skip to content

Commit

Permalink
Disable audio and video autoplay
Browse files Browse the repository at this point in the history
Fixes #9
  • Loading branch information
mr-pennyworth committed Feb 26, 2024
1 parent 80d4e9c commit 69f35e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions AlfredExtraPane.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.1.4;
MARKETING_VERSION = 0.1.5;
ONLY_ACTIVE_ARCH = NO;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = mr.pennyworth.AlfredExtraPane;
Expand All @@ -492,7 +492,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.1.4;
MARKETING_VERSION = 0.1.5;
ONLY_ACTIVE_ARCH = NO;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = mr.pennyworth.AlfredExtraPane;
Expand Down
13 changes: 10 additions & 3 deletions AlfredExtraPane/Pane.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,16 @@ func makeWindow() -> NSWindow {
}

func makeWebView() -> WKWebView {
let configuration = WKWebViewConfiguration()
configuration.preferences.setValue(true, forKey: "developerExtrasEnabled")
return WKWebView(frame: .zero, configuration: configuration)
let conf = WKWebViewConfiguration()
conf.preferences.setValue(true, forKey: "developerExtrasEnabled")

// TODO: allow configuration from prefs.json
// we don't want the pane to autoplay audio from the loaded webpage.
// (ideally, we want to be able to configure it, but till then, the
// quick fix is to disable autoplay).
conf.mediaTypesRequiringUserActionForPlayback = .all

return WKWebView(frame: .zero, configuration: conf)
}

func injectCSS(_ html: String) -> String {
Expand Down

0 comments on commit 69f35e4

Please sign in to comment.