Hi,
I want to create event by pressing the start button using JS.
Can i do it without compiling the player with such built-in functionality?
Maybe this button has any calss or id which i can "cling to"?
Thanks for the answer
I'm not sure what you mean. Can you explain it in another way? Can you give examples?
Do you want a custom event? Do you want to know when the existing UI play button is clicked?
Hm, in other way... I am an ordinary user and after clicking on this button https://prnt.sc/relfhg JS should add action(no matter what the action, maybe add the text under the player)
Ah, I see now. That's fairly easy. You can use the play and pause events from the video element.
const video = document.querySelector('video');
video.addEventListener('play', () => {
// do something here
});
video.addEventListener('pause', () => {
// do something else here?
});
Does this help?
i think yes, but one more stupid question please. Where i can add my code?(
Maybe there is some guide?
You don't have to modify Shaka Player to do what you are describing. Just add event 'play' and 'pause' event listeners to the video element in your application.
Does that help?
Oh, ok, very thx
Most helpful comment
You don't have to modify Shaka Player to do what you are describing. Just add event 'play' and 'pause' event listeners to the video element in your application.
Does that help?