@@ -131,19 +131,26 @@ const VideoPlayer = {
131
131
*/
132
132
onIframeTitleChange : ( callback ) => {
133
133
const iframe = VideoPlayer . iframe ( )
134
+ console . log ( 'iframe' , iframe ) ;
134
135
135
136
if ( iframe ?. contentWindow && iframe ?. contentDocument ) {
136
137
const title = iframe . contentDocument . querySelector ( 'title' )
137
138
138
139
if ( title ) {
139
140
// @ts -expect-error
140
141
const observer = new iframe . contentWindow . MutationObserver ( function ( mutations ) {
142
+ console . log ( 'got mutation' , mutations ) ;
141
143
mutations . forEach ( function ( mutation ) {
142
144
callback ( mutation . target . textContent )
143
145
} )
144
146
} )
147
+ console . log ( "watching iframe..." ) ;
145
148
observer . observe ( title , { childList : true } )
149
+ } else {
150
+ console . warn ( "could not access title in iframe" )
146
151
}
152
+ } else {
153
+ console . warn ( "could not access iframe?.contentWindow && iframe?.contentDocument" )
147
154
}
148
155
} ,
149
156
@@ -171,7 +178,9 @@ const VideoPlayer = {
171
178
let hasGottenValidVideoTitle = false
172
179
173
180
VideoPlayer . onIframeLoaded ( ( ) => {
181
+ console . log ( 'onIframeLoaded' , { hasGottenValidVideoTitle} ) ;
174
182
VideoPlayer . onIframeTitleChange ( ( title ) => {
183
+ console . log ( 'onIframeTitleChange' , { hasGottenValidVideoTitle, title} ) ;
175
184
if ( ! hasGottenValidVideoTitle ) {
176
185
const validTitle = VideoPlayer . getValidVideoTitle ( title )
177
186
0 commit comments