{"record":{"id":"f570a4c1d20340de","repo":"copy/v86","slug":"web-browser-doesn-t-support-web-audio-api","errorCode":null,"errorMessage":"Web browser doesn't support Web Audio API","messagePattern":"Web browser doesn't support Web Audio API","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/browser/speaker.js","lineNumber":30,"sourceCode":"/* global registerProcessor, sampleRate */\n\nconst DAC_QUEUE_RESERVE = 0.2;\n\nconst AUDIOBUFFER_MINIMUM_SAMPLING_RATE = 8000;\n\n/**\n * @constructor\n * @param {!BusConnector} bus\n */\nexport function SpeakerAdapter(bus)\n{\n    if(typeof window === \"undefined\")\n    {\n        return;\n    }\n    if(!window.AudioContext && !window[\"webkitAudioContext\"])\n    {\n        console.warn(\"Web browser doesn't support Web Audio API\");\n        return;\n    }\n\n    var SpeakerDAC = window.AudioWorklet ? SpeakerWorkletDAC : SpeakerBufferSourceDAC;\n\n    /** @const */\n    this.bus = bus;\n\n    this.audio_context = window.AudioContext ? new AudioContext() : new webkitAudioContext();\n\n    /** @const */\n    this.mixer = new SpeakerMixer(bus, this.audio_context);\n\n    /** @const */\n    this.pcspeaker = new PCSpeaker(bus, this.audio_context, this.mixer);\n\n    this.dac = new SpeakerDAC(bus, this.audio_context, this.mixer);\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/copy/v86/blob/180830d539dcc87db1a191febf6c914f516d102f/src/browser/speaker.js#L12-L48","documentation":"SpeakerAdapter (src/browser/speaker.js:30) checks for window.AudioContext or window.webkitAudioContext before constructing a DAC (AudioWorklet or BufferSource based). If neither exists, the browser does not implement the Web Audio API, v86 logs this warning and returns — no audio output is created, but emulation continues. It is a capability warning, not an exception.","triggerScenarios":"Instantiating SpeakerAdapter (e.g. via V86's autostart/speaker options) in a runtime where window exists but has neither AudioContext nor webkitAudioContext — old browsers, some webviews, or non-browser embeddings that define window without Web Audio.","commonSituations":"Running v86 in an outdated browser (pre-2015 Safari/IE-based webviews); embedding v86 in Electron/WebView builds with Web Audio disabled or removed; headless or sandboxed environments that stub window but not AudioContext; feature detection failing after a browser policy disabled audio.","solutions":["Upgrade to a modern browser that implements the Web Audio API (any current Chrome, Firefox, Safari, Edge)","If embedding (Electron/webview), ensure Web Audio is enabled and autoplay policy permits audio (configure autoplay policy flags)","Guard your integration: check (window.AudioContext || window.webkitAudioContext) before requesting speaker output and skip audio gracefully","If audio is optional, ignore the warning — v86 continues running without sound"],"exampleFix":"// before\nnew V86({ wasm_path, screen_container, speaker: true });\n// after\nif(window.AudioContext || window.webkitAudioContext)\n{\n    new V86({ wasm_path, screen_container, speaker: true });\n}\nelse\n{\n    new V86({ wasm_path, screen_container }); // run without audio\n}","handlingStrategy":"fallback","validationCode":"function supportsWebAudio()\n{\n    return typeof window !== 'undefined' && !!(window.AudioContext || window.webkitAudioContext);\n}\n// Only pass speaker: true if supportsWebAudio() returns true","typeGuard":"function hasAudioContext(win = window)\n{\n    return typeof win.AudioContext === 'function' || typeof win['webkitAudioContext'] === 'function';\n}","tryCatchPattern":"// Not an exception, but guard construction anyway\ntry\n{\n    if(hasAudioContext()) { new V86({ ..., speaker: true }); }\n    else { new V86({ ... }); } // silent fallback: no speaker option\n}\ncatch(e) { console.error('v86 init failed:', e); }","preventionTips":["Feature-detect AudioContext/webkitAudioContext before enabling speaker output","Test your embedding (Electron, webview, kiosk) with Web Audio enabled and autoplay policy configured","Do not treat this warning as fatal — v86 runs fine without sound","Keep browsers current; Web Audio has shipped in all major browsers since ~2015"],"tags":["audio","web-audio","browser-compatibility","feature-detection","v86"],"backgroundTag":"webaudio-unsupported","analyzedSha":"180830d539dcc87db1a191febf6c914f516d102f","analyzedAt":"2026-08-31T22:39:37.599Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}