From 71c11ddeb8a4b937db4473301ff1efa164eef0a2 Mon Sep 17 00:00:00 2001 From: Jonathan Dawson Date: Sat, 9 Nov 2019 11:34:08 -0600 Subject: [PATCH] initial commit for apple tv plus bugfix. --- inject.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/inject.js b/inject.js index a09e49e..e0ee74a 100644 --- a/inject.js +++ b/inject.js @@ -433,7 +433,7 @@ } else { var mediaTags = document.querySelectorAll('video'); } - + forEach.call(mediaTags, function(video) { video.vsc = new tc.videoController(video); }); @@ -444,6 +444,11 @@ try { var childDocument = frame.contentDocument } catch (e) { return } initializeWhenReady(childDocument); }); + + //look for video in shadowRoot + if (document.querySelector('apple-tv-plus-player')) { + console.log('Congratulations. There is the apple-tv-plus-player.') + } } function runAction(action, document, value, e) { @@ -458,13 +463,13 @@ // Get the controller that was used if called from a button press event e if (e) { var targetController = e.target.getRootNode().host; - } + } mediaTags.forEach(function(v) { var id = v.dataset['vscid']; var controller = document.querySelector(`div[data-vscid="${id}"]`); - // Don't change video speed if the video has a different controller + // Don't change video speed if the video has a different controller if (e && !(targetController == controller)) { return; } @@ -543,13 +548,13 @@ function setMark(v) { v.vsc.mark = v.currentTime; } - + function jumpToMark(v) { if (v.vsc.mark && typeof v.vsc.mark === "number") { v.currentTime = v.vsc.mark; } } - + function handleDrag(video, controller, e) { const shadowController = controller.shadowRoot.querySelector('#controller');