Fixes #2369: Video playback is reset on rotation
The viewWillTransition(to:with:) method in WebViewController was introduced to fix #3041, so I added an alternative solution using a resize handler in JS.
This commit is contained in:
parent
7608bf2ae6
commit
a731397486
@ -81,13 +81,6 @@ class WebViewController: UIViewController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
|
|
||||||
// We need to reload the webview on the iPhone when rotation happens to clear out any old bad viewport sizes
|
|
||||||
if traitCollection.userInterfaceIdiom == .phone {
|
|
||||||
loadWebView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Notifications
|
// MARK: Notifications
|
||||||
|
|
||||||
@objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
|
@objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
|
||||||
|
@ -155,6 +155,17 @@ function postRenderProcessing() {
|
|||||||
showFeedInspectorSetup();
|
showFeedInspectorSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onResize() {
|
||||||
|
const meta = document.querySelector("meta[name=viewport]");
|
||||||
|
|
||||||
|
if (!meta) return;
|
||||||
|
|
||||||
|
const originalContent = meta.content;
|
||||||
|
meta.setAttribute("content", originalContent + ", maximum-scale=1.0");
|
||||||
|
meta.setAttribute("content", originalContent);
|
||||||
|
}
|
||||||
|
window.addEventListener("resize", onResize);
|
||||||
|
|
||||||
|
|
||||||
function makeHighlightRect({left, top, width, height}, offsetTop=0, offsetLeft=0) {
|
function makeHighlightRect({left, top, width, height}, offsetTop=0, offsetLeft=0) {
|
||||||
const overlay = document.createElement('a');
|
const overlay = document.createElement('a');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user