Better media element detection

This commit is contained in:
hensm
2018-09-26 21:33:12 +01:00
parent b43f6e4579
commit b347a75157
3 changed files with 24 additions and 11 deletions

View File

@@ -12,9 +12,7 @@ let currentMedia;
const isLocalFile = srcUrl.startsWith("file:");
const mediaElement = isLocalFile
? document.querySelector("video, audio")
: document.querySelector(`[src="${srcUrl}"]`);
const mediaElement = browser.menus.getTargetElement(targetElementId);
window.addEventListener("beforeunload", () => {
browser.runtime.sendMessage({