fix(menu) autoplay on download in firefox

This commit is contained in:
coderaiser 2019-08-20 22:58:37 +03:00
parent 64e6b8387a
commit 511cceb9d9

View file

@ -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();