initial commit for apple tv plus bugfix.

This commit is contained in:
Jonathan Dawson
2019-11-09 11:34:08 -06:00
parent ec9f3f6d20
commit 71c11ddeb8

View File

@@ -433,7 +433,7 @@
} else { } else {
var mediaTags = document.querySelectorAll('video'); var mediaTags = document.querySelectorAll('video');
} }
forEach.call(mediaTags, function(video) { forEach.call(mediaTags, function(video) {
video.vsc = new tc.videoController(video); video.vsc = new tc.videoController(video);
}); });
@@ -444,6 +444,11 @@
try { var childDocument = frame.contentDocument } catch (e) { return } try { var childDocument = frame.contentDocument } catch (e) { return }
initializeWhenReady(childDocument); 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) { function runAction(action, document, value, e) {
@@ -458,13 +463,13 @@
// Get the controller that was used if called from a button press event e // Get the controller that was used if called from a button press event e
if (e) { if (e) {
var targetController = e.target.getRootNode().host; var targetController = e.target.getRootNode().host;
} }
mediaTags.forEach(function(v) { mediaTags.forEach(function(v) {
var id = v.dataset['vscid']; var id = v.dataset['vscid'];
var controller = document.querySelector(`div[data-vscid="${id}"]`); 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)) { if (e && !(targetController == controller)) {
return; return;
} }
@@ -543,13 +548,13 @@
function setMark(v) { function setMark(v) {
v.vsc.mark = v.currentTime; v.vsc.mark = v.currentTime;
} }
function jumpToMark(v) { function jumpToMark(v) {
if (v.vsc.mark && typeof v.vsc.mark === "number") { if (v.vsc.mark && typeof v.vsc.mark === "number") {
v.currentTime = v.vsc.mark; v.currentTime = v.vsc.mark;
} }
} }
function handleDrag(video, controller, e) { function handleDrag(video, controller, e) {
const shadowController = controller.shadowRoot.querySelector('#controller'); const shadowController = controller.shadowRoot.querySelector('#controller');