Skip to content

Commit 2b5c553

Browse files
author
Shane Osbourne
committed
debuggin
1 parent aa0e149 commit 2b5c553

File tree

1 file changed

+9
-0
lines changed
  • packages/special-pages/pages/duckplayer/src/js

1 file changed

+9
-0
lines changed

packages/special-pages/pages/duckplayer/src/js/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,26 @@ const VideoPlayer = {
131131
*/
132132
onIframeTitleChange: (callback) => {
133133
const iframe = VideoPlayer.iframe()
134+
console.log('iframe', iframe);
134135

135136
if (iframe?.contentWindow && iframe?.contentDocument) {
136137
const title = iframe.contentDocument.querySelector('title')
137138

138139
if (title) {
139140
// @ts-expect-error
140141
const observer = new iframe.contentWindow.MutationObserver(function (mutations) {
142+
console.log('got mutation', mutations);
141143
mutations.forEach(function (mutation) {
142144
callback(mutation.target.textContent)
143145
})
144146
})
147+
console.log("watching iframe...");
145148
observer.observe(title, { childList: true })
149+
} else {
150+
console.warn("could not access title in iframe")
146151
}
152+
} else {
153+
console.warn("could not access iframe?.contentWindow && iframe?.contentDocument")
147154
}
148155
},
149156

@@ -171,7 +178,9 @@ const VideoPlayer = {
171178
let hasGottenValidVideoTitle = false
172179

173180
VideoPlayer.onIframeLoaded(() => {
181+
console.log('onIframeLoaded', {hasGottenValidVideoTitle});
174182
VideoPlayer.onIframeTitleChange((title) => {
183+
console.log('onIframeTitleChange', {hasGottenValidVideoTitle, title});
175184
if (!hasGottenValidVideoTitle) {
176185
const validTitle = VideoPlayer.getValidVideoTitle(title)
177186

0 commit comments

Comments
 (0)