What I am trying to do is through extension I want to get current time of the video I tried.
var htmlVideoPlayer = document.getElementsByTagName('video')[0];
htmlVideoPlayer.currentTime
but it is giving error.
Now look at this image
WHEN SELECTING CLASS OF IFRAME
It gives me the current time but I can't access it from my chrome extension.
It gives CORS error
Any way to get current time of youtube IFRAME video from some another website so I can use it in my extension
also used this function to get current time of the youtube IFRAME video from my extension.
this is my script.js
setInterval(function() {
if ($('document.querySelector(".video-stream").getCurrentTime()').length) {
console.log("Video Time Exists!");
var videoTime = document.querySelector('.video-stream').getCurrentTime();
console.log(videoTime);
}
else{
console.log("waiting");
}
}, 100);
and this is manifest
{
"manifest_version": 2,
"name":"MyExtension",
"version": "0.1",
"description": "NewExtension Coming soon",
"content_scripts":[{
"js":[
"js/jquery-3.5.1.js",
"js/script.js"
],
"run_at":"document_idle",
"matches":[
"http://*"
],
"all_frames": true
}],
"permissions":[
"tabs",
"activeTab"
]
}