Skip to content

Commit

Permalink
🐛 mediaDevices shim won't break in case of undefined
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Nov 4, 2022
1 parent 9028bf9 commit 0ad1c68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tab-manager/preload.mediadevices-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,7 @@ const getDisplayMedia = async (resolve, reject) => {
currentRoot = render(html`<${Container} resolve=${resolve} reject=${reject}/>`, getOrCreateRoot());
};

window.navigator.mediaDevices.getDisplayMedia = () => new Promise(getDisplayMedia);
// Some web applications break the mediaDevices capability
if (window.navigator.mediaDevices) {
window.navigator.mediaDevices.getDisplayMedia = () => new Promise(getDisplayMedia);
}

0 comments on commit 0ad1c68

Please sign in to comment.