Pause/Play YouTube

Hi Friends I have a youtube video that was linked using the Web Object/iFrame option and would like to know how could I use a button I have inserted to control the playback of this video.
Any help/examples would be great.


Hi Deni,

We suggest you can use the insert YouTube video feature instead of the web object.
Then, use the javascript as shown in this thread: AP - pause youtube video with button - ActivePresenter / Support Questions - ATOMI Community (

Please take a look at the attached project for detail:
Play-button-JS.approj (1.4 MB)

P/s: Make sure that the name of the YouTube video object is accurately entered in the script.


Enjoy your time,

Thank you, Thuy. I worked very well. but I have another situation here, how coul dI do the same with videos that are hosted somewhere else?


Hi Deni,

To play/pause a video hosted somewhere, it is necessary to access the API offered by that platform. Using the Youtube API will not allow you to control videos on platforms other than Youtube.
So, to get the appropriate help, you should reach out to the specific platform.


Hi Thuy, a question that occurred me…
By the way, the code worked great! Thank you for your great help.

Ok, back to my question. You helped me with the code to play/pause my YouTube video from a button. Would you please help me with a code to move back and forward 5 sec?

Thanks ahead!

Hi Deni,

You can use Youtube APIs player.getCurrentTime():Number and player.seekTo(seconds:Number, allowSeekAhead:Boolean):Void to move back and forward 5 seconds:

// move back 5s:
var prev5s = ytPlayer.getCurrentTime() - 5;
if (prev5s < 0)
  prev5s = 0;
ytPlayer.seekTo(prev5s, true);

// move forward 5s:
var next5s = ytPlayer.getCurrentTime() + 5;
if (next5s > ytPlayer.getDuration())
  next5s = ytPlayer.getDuration();
ytPlayer.seekTo(next5s, true);


Hi Toan, The code didn’t work. Did we miss anything?

Here is the sample…

navigation buttons.approj (856 KB)

Hi Deni,

You need to get ytPlayer from the Youtube object name (as what we do in the play/pause script):

var ytIframeId = $(prez.object('YouTube_1').node).find('iframe').attr('id');
var ytPlayer = YT.get(ytIframeId);


Got it. Thanks. You guys rock!