mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
browser(firefox): screencast for Mac headful (#2985)
This commit is contained in:
parent
056f0e290d
commit
89ccf99b90
@ -1,2 +1,2 @@
|
|||||||
1129
|
1130
|
||||||
Changed: yurys@chromium.org Wed Jul 15 23:55:13 GMTST 2020
|
Changed: yurys@chromium.org Thu Jul 16 15:31:21 PDT 2020
|
||||||
|
@ -296,7 +296,8 @@ class PageHandler {
|
|||||||
const docShell = this._pageTarget._gBrowser.ownerGlobal.docShell;
|
const docShell = this._pageTarget._gBrowser.ownerGlobal.docShell;
|
||||||
// Exclude address bar and navigation control from the video.
|
// Exclude address bar and navigation control from the video.
|
||||||
const rect = this._pageTarget.linkedBrowser().getBoundingClientRect();
|
const rect = this._pageTarget.linkedBrowser().getBoundingClientRect();
|
||||||
this._videoSessionId = screencast.startVideoRecording(docShell, file, width, height, scale || 0, rect.top);
|
const devicePixelRatio = this._pageTarget._window.devicePixelRatio;
|
||||||
|
this._videoSessionId = screencast.startVideoRecording(docShell, file, width, height, scale || 0, devicePixelRatio * rect.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
stopVideoRecording() {
|
stopVideoRecording() {
|
||||||
|
@ -37,30 +37,14 @@ rtc::scoped_refptr<webrtc::VideoCaptureModule> CreateWindowCapturer(nsIWidget* w
|
|||||||
HeadlessWidget* headlessWidget = static_cast<HeadlessWidget*>(widget);
|
HeadlessWidget* headlessWidget = static_cast<HeadlessWidget*>(widget);
|
||||||
return HeadlessWindowCapturer::Create(headlessWidget);
|
return HeadlessWindowCapturer::Create(headlessWidget);
|
||||||
}
|
}
|
||||||
#ifdef MOZ_WIDGET_GTK
|
uintptr_t rawWindowId = reinterpret_cast<uintptr_t>(widget->GetNativeData(NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID));
|
||||||
mozilla::widget::CompositorWidgetInitData initData;
|
if (!rawWindowId) {
|
||||||
widget->GetCompositorWidgetInitData(&initData);
|
fprintf(stderr, "Failed to get native window id\n");
|
||||||
const mozilla::widget::GtkCompositorWidgetInitData& gtkInitData = initData.get_GtkCompositorWidgetInitData();
|
|
||||||
nsCString windowId;
|
|
||||||
# ifdef MOZ_X11
|
|
||||||
windowId.AppendPrintf("%lu", gtkInitData.XWindow());
|
|
||||||
return webrtc::DesktopCaptureImpl::Create(sessionId, windowId.get(), webrtc::CaptureDeviceType::Window);
|
|
||||||
# else
|
|
||||||
// TODO: support in wayland
|
|
||||||
fprintf(stderr, "Video capture for Wayland is not implemented\n");
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
# endif
|
}
|
||||||
#elif defined(_WIN32)
|
|
||||||
mozilla::widget::CompositorWidgetInitData initData;
|
|
||||||
widget->GetCompositorWidgetInitData(&initData);
|
|
||||||
const mozilla::widget::WinCompositorWidgetInitData& winInitData = initData.get_WinCompositorWidgetInitData();
|
|
||||||
nsCString windowId;
|
nsCString windowId;
|
||||||
windowId.AppendPrintf("%lu", winInitData.hWnd());
|
windowId.AppendPrintf("%" PRIuPTR, rawWindowId);
|
||||||
return webrtc::DesktopCaptureImpl::Create(sessionId, windowId.get(), webrtc::CaptureDeviceType::Window);
|
return webrtc::DesktopCaptureImpl::Create(sessionId, windowId.get(), webrtc::CaptureDeviceType::Window);
|
||||||
#else
|
|
||||||
fprintf(stderr, "Video capture is not implemented on this platform\n");
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user