Forum Discussion
Play button
Is there a way to detect if the play button has been pressed on a video? I have a play/pause button on the slide as well and want to keep them both in sync
- WaltHamiltonSuper Hero
Probably the best way is to use the slide timeline and controls for both. Start the video when the slide timeline starts, and do not allow the video to be controlled independently of the slide. Do that by not showing video controls, and covering the video with a transparent shape (filled with 98% transparency).
That ties the video to the slide timeline, unless of course, it is a web object.
- PhilMayor-b4ca0Community Member
Thanks, Walt; that doesn't work for the slide, unfortunately; I had already suggested that.
I don't think you need 98% transparency anymore 100% should work now.
I am going to have a dig into some javascript to solve it.
- SinchuRaj-Community Member
Hey Phil , try this - Custom Video Player - Articulate Storyline Discussions - E-Learning Heroes
- PhilMayorSuper Hero
This one looks great as well, I think Nedim’s solution is probably best to work with what I have but will keep this in mind for future projects. Thanks.
- NedimCommunity Member
Hi Phil,
I use a javascript video "ontimeupdate" function to detect if video is playing or not. Basically, it detects when either play or pause button has been pressed. Not sure if it's exactly what are you looking for. Check my short video and let me know if you need a code.
- PhilMayorSuper Hero
Hi Nedim thanks that looks like a perfect solution could you post the code? Thank you
- NedimCommunity Member
Here you go Phil:
let video = document.getElementsByTagName('video')[0];
video.ontimeupdate = function() {
if (video.playing) {
GetPlayer().SetVar('isVideoPlaying', true);
} else {
GetPlayer().SetVar('isVideoPlaying', false);
}
};
I also attached the storyline file for reference.
- PhilMayor-b4ca0Community Member
Thanks for this really appreciate it