SamuelScheit / puppeteer-stream

A Library for puppeteer to retrieve audio and video streams of webpages
MIT License
366 stars 117 forks source link

Update: Video recording not honoring emulated device viewport (iPhone 14 Pro Max) #180

Open nishitarora2200 opened 6 days ago

nishitarora2200 commented 6 days ago

Update:

I have also tried explicitly setting the browser window size to match the device's resolution using the --window-size argument. Here's the updated code:

const browser = await launch({
    args: [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-dev-shm-usage',
        '--window-size=430,739' // iPhone 14 Pro Max dimensions
    ],
    // headless: false,
    userDataDir: userDataDir,
    executablePath: getExecutablePath()
});

Despite this, the recorded video still has a width significantly larger than expected. It seems like the recording is ignoring the set window size and/or the emulated device viewport.

Originally posted by @nishitarora2200 in https://github.com/SamuelScheit/puppeteer-stream/issues/179#issuecomment-2485884690

nishitarora2200 commented 5 days ago

@SamuelScheit Please update on this

SamuelScheit commented 5 days ago

Maybe the banner "This browser is being remote controlled" hides the page content and causes a slightly different video resolution:

to remove this banner add those launch options:

args: [
    "--disable-blink-features=AutomationControlled",
],
ignoreDefaultArgs: ["--enable-automation"],
nishitarora2200 commented 5 days ago

@SamuelScheit Still same output after applying these launch options.

        const browser = await launch({
            args: [
                '--no-sandbox',
                '--disable-setuid-sandbox',
                '--disable-dev-shm-usage',
                '--disable-blink-features=AutomationControlled',
                '--window-size=430,739' // iPhone 14 Pro Max dimensions
            ],
            ignoreDefaultArgs: ["--enable-automation"],
            // headless: false,
            userDataDir: userDataDir,
            executablePath: getExecutablePath()
        });
nishitarora2200 commented 4 days ago

@SamuelScheit Any update on this ?