-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: ApiVideoPlayer IFRAME steals focus for key presses when autoplay property is set to false. #21
Comments
This is still a bug the the api.video player but a workaround can be a applied where the autoplay prop is set to true and the video is paused in response to the onReady callback. This will reproduce the effective autoplay=false behavior but the main window still has focus and keyUp/keyDown events etc can be received. |
The above workaround (setting autoplay to true and pausing the video) did not help the situation on iPad Chrome and iPad Edge as this resulted in the audio not playing - see bug reported #22 Instead we have to detect that the window has blured, then take the focus back after a few miliseconds. We then simulate the keyUp even that we missed. The inputs/access then works as expected. Clearly this workaround is not ideal. |
Hi @will-grange-inclusive |
@will-grange-inclusive can you try with the new v1.1.0 version ? Please note that there is one breaking change with this version. You'll now have to use const videoRef = useRef<ApiVideoPlayerRef>(null) instead of: const videoRef = useRef<ApiVideoPlayer>(null) To fix the focus issue, you can use the following parameter: <ApiVideoPlayer
hotKeys={false}
// ... We've also add a new <ApiVideoPlayer
customDomain='embed.xxxx.com' // replace with your domain
// ...
``` |
@olivierapivideo - I've tested this on a branch of the bug demo app and with the hotKeys={false} property applied, that the key presses are no longer being swallowed by the IFRAME contents. We are mid testing (many videos * platforms * access methods to test), so not applying to our main code base just yet but closing this based on the demo app resolution. |
Version
@api.video/[email protected]
Environment that reproduces the issue
Windows Chrome, but this appears to be common accross all browsers/devices tested so far.
Is it reproducible in the example application?
Yes
Reproduction steps
Clone and run the source code from the demo available here. See instructions in the README.md
https://bitbucket.org/inclusive/api-video-taking-focus/src/master/
The demo sets up the ApiVideoPlayer with autoplay=true and autoplay=false depending on what is passed in the URL to show different behavior.
Key presses are being made to unpause the video which pauses automatically again after 3 seconds by design. When autoplay=false, it can clearly be seen that the IFRAME steals focus and therefor the containing window cannot recieve keyDown or keyUp events. Clicking into the parent window again will refocus the parent and keypresses can be used again.
Scenario functioning correctly
Scenario functioning incorrectly
Expected result
Parent window can recieve keyUp and keyDown events, without the IFRAME taking focus when autoplay=false.
Actual result
No keyUp and keyDown events received because the IFRAME has focus after the first keypress.
Additional context
No response
Relevant logs output
No response
The text was updated successfully, but these errors were encountered: