mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(screencast): remove white padding in headless chromium (#3746)
This commit is contained in:
parent
de547d7d65
commit
0976732ec6
@ -827,15 +827,17 @@ class FrameSession {
|
||||
}),
|
||||
];
|
||||
if (this._windowId) {
|
||||
// TODO: popup windows have their own insets.
|
||||
let insets = { width: 24, height: 88 };
|
||||
if (process.platform === 'win32')
|
||||
insets = { width: 16, height: 88 };
|
||||
else if (process.platform === 'linux')
|
||||
insets = { width: 8, height: 85 };
|
||||
else if (process.platform === 'darwin')
|
||||
insets = { width: 2, height: 80 };
|
||||
|
||||
let insets = { width: 0, height: 0 };
|
||||
if (this._crPage._browserContext._browser._options.headful) {
|
||||
// TODO: popup windows have their own insets.
|
||||
insets = { width: 24, height: 88 };
|
||||
if (process.platform === 'win32')
|
||||
insets = { width: 16, height: 88 };
|
||||
else if (process.platform === 'linux')
|
||||
insets = { width: 8, height: 85 };
|
||||
else if (process.platform === 'darwin')
|
||||
insets = { width: 2, height: 80 };
|
||||
}
|
||||
promises.push(this._client.send('Browser.setWindowBounds', {
|
||||
windowId: this._windowId,
|
||||
bounds: { width: viewportSize.width + insets.width, height: viewportSize.height + insets.height }
|
||||
|
@ -51,7 +51,7 @@ export class VideoRecorder {
|
||||
assert(!this._isRunning());
|
||||
const w = options.width;
|
||||
const h = options.height;
|
||||
const args = `-f image2pipe -c:v mjpeg -i - -y -an -r ${fps} -c:v vp8 -vf pad=${w}:${h}:0:0:gray,crop=${w}:${h}:0:0`.split(' ');
|
||||
const args = `-loglevel error -f image2pipe -c:v mjpeg -i - -y -an -r ${fps} -c:v vp8 -vf pad=${w}:${h}:0:0:gray,crop=${w}:${h}:0:0`.split(' ');
|
||||
args.push(options.outputFile);
|
||||
const progress = this._progress;
|
||||
// Use ffmpeg provided by the host system.
|
||||
|
@ -318,9 +318,7 @@ describe('screencast', suite => {
|
||||
await context.close();
|
||||
});
|
||||
|
||||
it('should scale frames down to the requested size ', test => {
|
||||
test.fixme(options.CHROMIUM && options.HEADLESS, 'Window is not resized when changing viewport');
|
||||
}, async ({page, videoPlayer, tmpDir, server, toImpl}) => {
|
||||
it('should scale frames down to the requested size ', async ({page, videoPlayer, tmpDir, server, toImpl}) => {
|
||||
await page.setViewportSize({width: 640, height: 480});
|
||||
const videoFile = path.join(tmpDir, 'v.webm');
|
||||
await page.goto(server.PREFIX + '/checkerboard.html');
|
||||
|
Loading…
x
Reference in New Issue
Block a user