Shaka-player: Event by pressing the start button

Created on 10 Mar 2020  路  6Comments  路  Source: google/shaka-player

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

archived question

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?

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baseballbrad3 picture baseballbrad3  路  4Comments

gkal19 picture gkal19  路  6Comments

diogoazevedos picture diogoazevedos  路  5Comments

luusetsenkoodbichsen picture luusetsenkoodbichsen  路  3Comments

dakom picture dakom  路  3Comments