I am writing a Chrome extension in Javascript and I want to get the current time to play the video on youtube.com. I tried using the answer from the question Get the current time of a YouTube video , for example:
ytplayer = document.getElementById ("movie_player");
ytplayer.getCurrentTime ();
However, I get the following error: "Uncaught TypeError: cannot read the getCurrentTime property" null ";
What am I doing wrong? I tried different values for ElementId - movie_player, player ....
Any help is appreciated. Thanks in advance.
Greetings.
edit:
Here is my manifest:
{
"manifest_version": 2,
"name": "",
"description": "",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "basic.html"
},
"permissions": [
"tabs",
"activeTab", "http://*/*", "https://*/*"
]
}
Another thing: If I execute this code:
ytplayer = document.getElementById("movie_player");
ytplayer.getCurrentTime();
Javascript Youtube .
, , , null.
, , , Youtube.
, .