I'm working on a chrome extension that uses the ytplayer object from a youtube page in my contentscript.js file. In the past the ytplayer object updates every time you navigate to a new youtube video. As of now, i don't see it updating any more.
How to replicate
- Go to a youtube video page in chrome (For example, https://www.youtube.com/watch?v=KUh2O8HylUM)
- Open the dev tools console
- Type in 'ytplayer.config.args' in the console
- Capture the ytplayer.config.args object
- Navigate to another youtube video by clicking on another video from the recommended list.
- Type in ytplayer.config.args again
- Compare to previous ytplayer.config.args you captured earlier
You'll see that the ytplayer doesn't update after navigating to the 2nd video. My extension uses this object. The problem is that the object is stale after navigating to another video. When i pull the ytplayer object after every video navigation, I present wrong data because the ytplayer is always from the first video.
Questions.
Is there a way in to get the updated ytplayer?
Is there a way to make the ytplayer reload? (I can add a location.reload() to my js code which fixes the issue but it's hacky and lame)
Is there another way to get the ytplayer.conf.args data from a youtube video page in chrome?