Skip to content

Commit ace9014

Browse files
author
Oil3
committed
preparing for user options (auto mute, auto play, etc)
1 parent b028bdc commit ace9014

2 files changed

Lines changed: 5 additions & 68 deletions

File tree

Webm Quicklook.xcodeproj/xcuserdata/zzs.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,4 @@
33
uuid = "E71DBFCB-09D0-4E83-BE4F-3320B489D463"
44
type = "1"
55
version = "2.0">
6-
<Breakpoints>
7-
<BreakpointProxy
8-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
9-
<BreakpointContent
10-
uuid = "35F05571-6629-4EBE-93D1-EC0AE2F1A314"
11-
shouldBeEnabled = "Yes"
12-
ignoreCount = "0"
13-
continueAfterRunningActions = "No"
14-
filePath = "WebM Quicklook/PreviewViewController.swift"
15-
startingColumnNumber = "9223372036854775807"
16-
endingColumnNumber = "9223372036854775807"
17-
startingLineNumber = "12"
18-
endingLineNumber = "12"
19-
landmarkName = "PreviewViewController"
20-
landmarkType = "3">
21-
</BreakpointContent>
22-
</BreakpointProxy>
23-
<BreakpointProxy
24-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
25-
<BreakpointContent
26-
uuid = "BA1A5476-3D1F-4A4B-AC6C-647927331429"
27-
shouldBeEnabled = "No"
28-
ignoreCount = "0"
29-
continueAfterRunningActions = "No"
30-
filePath = "WebM Quicklook/PreviewViewController.swift"
31-
startingColumnNumber = "9223372036854775807"
32-
endingColumnNumber = "9223372036854775807"
33-
startingLineNumber = "54"
34-
endingLineNumber = "54"
35-
landmarkName = "webView(_:didFailProvisionalNavigation:withError:)"
36-
landmarkType = "7">
37-
</BreakpointContent>
38-
</BreakpointProxy>
39-
<BreakpointProxy
40-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
41-
<BreakpointContent
42-
uuid = "2E69AD89-5F36-4F74-A904-9E6EF359EE4A"
43-
shouldBeEnabled = "No"
44-
ignoreCount = "0"
45-
continueAfterRunningActions = "No"
46-
filePath = "WebM Quicklook/PreviewViewController.swift"
47-
startingColumnNumber = "9223372036854775807"
48-
endingColumnNumber = "9223372036854775807"
49-
startingLineNumber = "55"
50-
endingLineNumber = "55"
51-
landmarkName = "PreviewViewController"
52-
landmarkType = "3">
53-
</BreakpointContent>
54-
</BreakpointProxy>
55-
</Breakpoints>
566
</Bucket>

Webm Quicklook/PreviewViewController.swift

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,9 @@ import WebKit
1111

1212
class PreviewViewController: NSViewController, QLPreviewingController {
1313

14-
// override var nibName: NSNib.Name? {
15-
// return NSNib.Name("PreviewViewController")
16-
// }
1714
var webView = WKWebView(frame: .zero)
1815

19-
2016
func preparePreviewOfFile(at url: URL, completionHandler: @escaping (Error?) -> Void) {
21-
// Load the file URL in webView
2217
webView.loadFileURL(url, allowingReadAccessTo: url)
2318
completionHandler(nil)
2419
}
@@ -27,15 +22,7 @@ class PreviewViewController: NSViewController, QLPreviewingController {
2722
self.view = NSView()
2823
self.view.addSubview(webView)
2924

30-
// required init?(coder: NSCoder) { fatalError() }
31-
// override init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) {
32-
// super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
33-
// }
34-
35-
3625
webView.translatesAutoresizingMaskIntoConstraints = false
37-
//
38-
// // Add constraints to fill the entire view
3926
NSLayoutConstraint.activate([
4027
webView.topAnchor.constraint(equalTo: view.topAnchor),
4128
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
@@ -44,11 +31,11 @@ class PreviewViewController: NSViewController, QLPreviewingController {
4431
])
4532
}
4633

47-
// func webView(_ webView: WKWebView, didStart navigation: WKNavigation!) {
48-
// webView.pauseAllMediaPlayback {
49-
// }
50-
// }
51-
34+
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
35+
let cssString = "::-webkit-media-controls-panel { display: none; }"
36+
let jsString = "var style = document.createElement('style'); style.innerHTML = '\(cssString)'; document.head.appendChild(style);"
37+
webView.evaluateJavaScript(jsString, completionHandler: nil)
38+
}
5239
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
5340
print("Navigation failure: \(error.localizedDescription)")
5441
}

0 commit comments

Comments
 (0)