-
|
I have youtube iframe's embedded in a reveal.js slide. However, I can't use any youtube shortcuts (e.g., |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
This is a security limitation—an iframe is not allowed to listen to keyboard events from its parent window. The only for it to gain access is if you click on and move focus to the iframe. The only fix I can think of for this would be to listen to the keyboard events in the parent window and then call |
Beta Was this translation helpful? Give feedback.
-
|
Hi @hakimel, thanks for the response! |
Beta Was this translation helpful? Give feedback.
-
|
BTW: Once I click on the YouTube player and use the keys there, is there a key that will exit the YT focus and get me back to reveal.js keys, or do I have to use a pointer? |
Beta Was this translation helpful? Give feedback.
-
|
You'll need to use your pointer to get out AFAIK. The parent window isn't allowed to know what keypresses occur inside of an iframe. That said it isn't possible to add a custom shortcut in reveal.js for moving focus back up to the parent window. |
Beta Was this translation helpful? Give feedback.
This is a security limitation—an iframe is not allowed to listen to keyboard events from its parent window. The only for it to gain access is if you click on and move focus to the iframe.
The only fix I can think of for this would be to listen to the keyboard events in the parent window and then call
postMessageAPI methods on the YouTube iframe to trigger the corresponding action. Not sure what events that YouTube supports in their postMessage API though.