# The speaker sometimes does not work when using Puppeteer with a fake media device

**URL:** <https://devforum.zoom.us/t/the-speaker-sometimes-does-not-work-when-using-puppeteer-with-a-fake-media-device/132367>\
**Category:** Web\
**Created:** [May 6, 2025, 3:37am UTC](https://devforum.zoom.us/t/the-speaker-sometimes-does-not-work-when-using-puppeteer-with-a-fake-media-device/132367 "2025-05-06T03:37:50Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [May 12, 2025, 6:59am UTC](https://devforum.zoom.us/t/the-speaker-sometimes-does-not-work-when-using-puppeteer-with-a-fake-media-device/132367/12 "2025-05-12T06:59:59Z")

</div>

Hi @lmtruong1512

> 9aF8YPhEQgaHxr4hoZwG3w==  
> UsIoxcsDSgerPxuK2NZwIQ==

After analyzing the logs, these two BOT users did not successfully start audio, possibly due to the browser’s autoplay policy requiring user interaction.

You can listen for the `auto-play-audio-failed` event.

> **[Video SDK - web - Event handling](https://developers.zoom.us/docs/video-sdk/web/handle-events/#auto-play-audio-failed)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

If you’re using Puppeteer, consider adding the launch flag `--autoplay-policy=no-user-gesture-required`.

> <https://github.com/puppeteer/puppeteer/issues/6774>
>
> I'm trying to play spotify via puppeteer. Because Chromium seems to not like aud…io file, I use chrome. 
> 
> In headful mode, everything work well, but when I switch to headless mode, the song doesn't play at all (as if I was using Chromium??).
> 
> I though headless would had the same feature than headfull. I also tested with Edge but same problem.
> 
> Here is my code 
> 
> \`\`\`
> var puppeteer = require('puppeteer');
> var util = require("./util.js");
> 
> async function initBrowser(){
> let browser = await puppeteer.launch({
> headless: false, //permet de voir
> slowMo: 15,
> executablePath: 'C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe',
> //
> //args: (url)?\[\`--proxy-server=${url}\`\]:\[\]
> });
> return browser;
> }
> 
> 
> exports.main = async function(){
> let browser = await initBrowser();
> let webPage = await browser.newPage();
> await webPage.goto("https://accounts.spotify.com/en/login/", { waitUntil: "load", timeout: 30000});
> //login
> await webPage.type('#login-username', 'LOGIN');
> await webPage.type('#login-password', 'PSWD');
> await webPage.click('#login-button');
> await util.sleep(1000);
> 
> //music
> await webPage.goto("https://open.spotify.com/artist/3nFkdlSjzX9mRTtwJOzDYB", { waitUntil: "load", timeout: 30000});
> await util.sleep(2500);
> await webPage.click('#onetrust-accept-btn-handler'); //accept cookie
> await util.sleep(1000);
> await webPage.click('div\[data-testid="action-bar-row"\] button\[data-testid="play-button"\]'); //click on play
> await webPage.screenshot({ path: 'test.png' })
> }
> \`\`\`
> 
> Am I really still using Chrome in headless mode?

Thanks  
Vic

---

_[View the full topic](https://devforum.zoom.us/t/the-speaker-sometimes-does-not-work-when-using-puppeteer-with-a-fake-media-device/132367)._
