Azure_1988
New Coder
I only just started using Javascript, so I do not know much. I am creating a iOS Shortcut that transfers the current video playing, onto a new tab. The Javascript works on some websites but not all. If the video playing is using the safari default video player, it does not work. It’s a Safari Shortcut.
JavaScript:
var elements = document.querySelectorAll("video")
var result = [];
var current = elements[0];
for (var i = 0 ; i < elements.length ; i++) {
if (elements[i].playbackRate > 0) {
elem = elements[i];
break;
}
}
if (current) {
result.push(current.src);
}
else {
result.push("@@@@@@@@@")
}
completion(result)