Audio that is started programmatically does not start playing after F10 or Alt is pressed
If you have a web page that plays audio programmatically, upon pressing F10 or Alt in an application that uses CEF to render the page, the audio will not start unless you subsequently click on the page or press another key. I have tried this in both the CEF sample application and in an application that uses CEF (Safe Exam Browser, which is where we originally saw this issue) on Windows 10.
I have tested pages that use two different third-party audio players and also a page that plays audio by directly using AudioContext, and all are affected by the issue, so I don’t think it is related to a specific audio player, and is instead an issue with CEF itself. The upshot of this is that when we run a speaking / listening exam in Safe Exam Browser (which uses CEF), a student can press F10 to pause the audio playlist and effectively pause the exam, which is not desirable.
The same issue does not happen in Chrome. If you press F10, the menu button becomes visibly focussed, but there is no impact on the page - audio will still play as expected when started programmatically.
A couple of example pages where this can be reproduced:
https://fdslive.oup.com/www.oup.com/elt/general_content/global/ote/demo-v3/#/exercise/speaking/1/1
To reproduce it:
- Open the page in the CEF sample application (or Safe Exam Browser).
- Click anywhere on the page (this seems to be necessary to reproduce the problem).
- Press F10 once audio starts playing.
Usually the currently-playing audio clip will finish, but then the next clip will not start and the exam will effectively freeze. Occasionally a playing audio clip may pause. Sometimes it doesn’t happen at all, in which case you can repeat steps 2 and 3 when the next clip is playing, and you should then reproduce it.
Comments (15)
-
-
reporter I just downloaded the latest CEF sample application stable build from here:
-
Are there any errors in the log?
-
reporter Please find debug and console logs below. I don’t think the messages shown are relevant to this issue though, because they appear when the page loads. There are no additional messages written when I press F10 and cause the problem to occur.
debug.log:
[0525/140750.276:WARNING:spdy_session.cc(3541)] Received HEADERS for invalid stream 79
[0525/140750.940:INFO:CONSOLE(9)] "NotAllowedError: Permission denied", source: https://oupuat-am.assessor.rm.com/engine/packages/AssessmentMaster/Resources/build/js/assessment-master.min.js?v=c85dd0f3e82aadb194a93c345054ab5b (9)
console.log:
Level: Info
Message: NotAllowedError: Permission denied
Line: 9
-
reporter Hi, any updates on this?
I’d just like to add that I have also tried a couple of applications that use libcef version 81.1.1.0 and the issue is not reproducible. It is reproducible in an application using version 97.1.1.0 - so it looks like it was introduced somewhere between those versions.
-
reporter Further to this, I can reproduce in an application (Safe Exam Browser 3.2.0) that uses libcef version 90, but not in an older version of the same application (3.1.1) which uses CEF 86. So I think the issue was introduced between versions 86 and 90.
-
reporter I have done some more investigation on this, please see this comment against the Safe Exam Browser project on Github:
https://github.com/SafeExamBrowser/seb-win-refactoring/issues/408#issuecomment-1152142159
The issue seems to be that when you press F10 (or Alt) when the "enable-media-stream" argument has been passed to CEF / Chromium, the focus switches to a hidden menu and this pauses Javascript execution. If you press Enter after pressing F10 or Alt the menu itself actually appears. But this does not happen when "enable-media-stream" is disabled, which seems very bizarre.
-
What does the menu look like?
-
reporter Like this:
-
What version did you test with? (Exact version, load chrome://version if needed).
What command line args did you use for cefclient? Just enable-media-stream?
-
reporter The version of Safe Exam Browser that I tested with uses CEF 97.1.1.0. The full output from chrome://version can be seen here (it looks like this also shows the command line args):
https://photos.app.goo.gl/uKw5uvH2DSE6Ywo4A
In the Safe Exam Browser source code there is a line that adds the “enable-media-stream” command line argument to CEF:
cefSettings.CefCommandLineArgs.Add("enable-media-stream");
If I comment this out and rebuild Safe Exam Browser, the problem does not occur.
-
Thanks, I'm actually after details of the cefclient version/args.
-
reporter I can reproduce the issue in this version of the CEF client application, without specifying any command line arguments (I just launched the EXE):
-
Does the problem reproduce with version 103.0.6+ge38efd5+chromium-103.0.5060.53? (Current beta)
-
reporter Yes, it is still reproducible in that version.
- Log in to comment
What CEF version(s) have you tested?