Skip to content

Commit

Permalink
Refine fake screenshare handling and media configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano committed Feb 6, 2025
1 parent bb273dc commit 7be9bad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions scripts/screenshare.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ webrtcperf.startFakeScreenshare = (
wrapper.setAttribute('id', 'webrtcperf-fake-screenshare')
wrapper.setAttribute(
'style',
`all: unset; position: fixed; top: 0; left: 0; width: ${width}px; height: ${height}px; z-index: 99999; background-color: black; isolation: isolate; transform-style: flat;`,
`all: unset; position: fixed; top: 0; left: 0; width: ${width}px; height: ${height}px; z-index: ${webrtcperf.USE_FAKE_MEDIA ? '-1' : '1'}; background-color: black; isolation: isolate; transform-style: flat;`,
)
document.body.appendChild(wrapper)
//webrtcperf.GET_DISPLAY_MEDIA_CROP = '#webrtcperf-fake-screenshare'

if (webrtcperf.USE_FAKE_MEDIA) {
webrtcperf.GET_DISPLAY_MEDIA_CROP = '#webrtcperf-fake-screenshare'
}

if (pointerAnimation) {
const el = document.createElement('div')
Expand Down
3 changes: 2 additions & 1 deletion src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ try {
webrtcperf.params = {};
}
webrtcperf.GET_DISPLAY_MEDIA_TYPE = "${this.getDisplayMediaType}";
webrtcperf.USE_FAKE_MEDIA = "${this.useFakeMedia}";
`

if (this.serverPort) {
Expand Down Expand Up @@ -1338,7 +1339,7 @@ webrtcperf.VIDEO_URL = "http${this.serverUseHttps ? 's' : ''}://localhost:${this
await page.exposeFunction('webrtcperf_sdpWrite', (sdp: sdpTransform.SessionDescription) => sdpTransform.write(sdp))

await page.exposeFunction('webrtcperf_startFakeScreenshare', async () => {
if (!this.browser) return
if (!this.browser || this.getDisplayMediaType === 'monitor') return
let screensharePage = page
if (!this.useFakeMedia) {
if (!this.screensharePage) {
Expand Down

0 comments on commit 7be9bad

Please sign in to comment.