0

I have a youtube video open on my browser. How to go to specific time stamp using javascript? I want to use this in chrome extension. I can give the t query in url but it reloads the whole page. I don't want to reload the whole page. Help me with this. Thanks

sandeysh
  • 11
  • 5
  • Write a [content script](https://developer.chrome.com/extensions/content_scripts) that finds the `video` element and sets its `currentTime`. – wOxxOm Apr 20 '21 at 12:36

1 Answers1

2

Try the player.seekTo(seconds:Number, allowSeekAhead:Boolean) function:

document.getElementById("movie_player").seekTo(seconds,true);

Resources :https://developers.google.com/youtube/iframe_api_reference?csw=1#Playback_controls

credit to this answer for getting the player element

ATP
  • 2,025
  • 2
  • 9
  • 24