I'm sure this should to be quite easy, but I can't find the answer elsewhere...
I'm embedding a youtube (live) video on my domain through an iframe. I've managed to detect when the user clicks on the pause/play button using javascript events defined in onYouTubeIframeAPIReady. I'd like to detect when the user clicks on the speaker icon (sound muted/sound on), on the fullscreen button, and also when he/she clicks on the "go to youtube" button.
Is this posisble?
Thanks in advance for your help.
You can utilize Youtube Embed API and hide standard controls with controls:0 option. Add your own controls with all callbacks/event handlers you need.
Best option — you can use Player Events and act accordingly. There is onStateChange available, so, you can detect and verify pause/unpause. Mute status can be verified too - you need to check muted status with isMuted() method constantly.
For Youtube button click I see this way to check - you can monitor window active state via visibilitychange and check iframe focus state to get video details (will not work in fullscreen I guess).
For fullscreen - fullscreenchange event. In coupe with current active (playing) video you can check exact embedded video where fullscreen was clicked. Im not sure about the situation when fullscreen was clicked before play button was clicked by user.