You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Add an example for feeding an audio file as microphone input (Chromium) #2056
Add a runnable example to examples/ that shows how to test a page that records from the microphone, by feeding a WAV file as the microphone input. No API change: it uses existing launch args and grantPermissions.
Example
examples/src/main/java/org/example/FakeMicrophoneInput.java, a plain main() class (Java 8), plus a short section in examples/README.md. It:
launches Chromium with --use-fake-ui-for-media-stream, --use-fake-device-for-media-stream and --use-file-for-fake-audio-capture=<wav>, and grants the microphone permission
plays a WAV file given as an argument (e.g. a recorded spoken phrase), or a tone it generates in plain Java
serves a small page at http://localhost/ with page.route (getUserMedia needs a secure context), which listens with a Web Audio analyser, and waits for the page to detect the input
Limitations: Chromium only. The file is read at launch and loops. It feeds pages that use getUserMedia (MediaRecorder, WebRTC, Web Audio), not webkitSpeechRecognition, which uses the system microphone.
Motivation
Pages with speech input, voice search or audio recording are hard to automate: CI has no microphone, and the permission prompt blocks the test. The Chromium switches that solve this are documented only in Chromium's sources, so users keep rediscovering them.
Related upstream request: microsoft/playwright#39297 (a first-class mic API, closed as not planned). This asks only for an example built on what already works.
I have a working implementation and would like to contribute it if this fits in examples/.
Thanks for the proposal. We're going to pass on adding this to examples/: we keep that folder to a few minimal tours of the Playwright API, and this recipe relies on Chromium command-line switches that are not part of Playwright and that our CI does not exercise.
It is also the kind of snippet a coding agent produces readily today. A prompt like "write a Playwright Java example that feeds a WAV file as microphone input in Chromium" gets you a working version, tailored to your page, so a checked-in copy adds little.
The approach in #2057 is fine to use in your own tests, and it stays searchable here. Closing as not planned.
Thank you for reviewing the contribution and explaining the repository's approach.
I understand the decision and the reasoning behind keeping the examples minimal and aligned with supported Playwright APIs.
I'll continue using this approach in my own automation projects. I appreciate you keeping the PR and issue searchable for others facing similar challenges.
Activity
yury-s commentedon Nov 18, 2026
Thanks for the proposal. We're going to pass on adding this to
examples/: we keep that folder to a few minimal tours of the Playwright API, and this recipe relies on Chromium command-line switches that are not part of Playwright and that our CI does not exercise.It is also the kind of snippet a coding agent produces readily today. A prompt like "write a Playwright Java example that feeds a WAV file as microphone input in Chromium" gets you a working version, tailored to your page, so a checked-in copy adds little.
The approach in #2057 is fine to use in your own tests, and it stays searchable here. Closing as not planned.
ashwinitodewar491 commentedon Nov 19, 2026
Thank you for reviewing the contribution and explaining the repository's approach.
I understand the decision and the reasoning behind keeping the examples minimal and aligned with supported Playwright APIs.
I'll continue using this approach in my own automation projects. I appreciate you keeping the PR and issue searchable for others facing similar challenges.
Looking forward to contributing again!