mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(menu) autoplay on download in firefox
This commit is contained in:
parent
64e6b8387a
commit
511cceb9d9
1 changed files with 17 additions and 0 deletions
|
|
@ -295,6 +295,8 @@ function download(type) {
|
|||
src,
|
||||
});
|
||||
|
||||
mute(element);
|
||||
|
||||
const {body} = document;
|
||||
const removeChild = body.removeChild.bind(body, element);
|
||||
|
||||
|
|
@ -305,6 +307,21 @@ function download(type) {
|
|||
}
|
||||
}
|
||||
|
||||
// prevent firefox from auto play
|
||||
function mute(element) {
|
||||
element.contentWindow.addEventListener('load', () => {
|
||||
const video = element.contentWindow
|
||||
.document
|
||||
.body
|
||||
.querySelector('audio, video');
|
||||
|
||||
if (!video)
|
||||
return;
|
||||
|
||||
video.pause();
|
||||
});
|
||||
}
|
||||
|
||||
function getCurrentPosition() {
|
||||
const current = Info.element;
|
||||
const rect = current.getBoundingClientRect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue