Screen Sharing Error on Mac Safari 18.0.1 After Canceling Permission
I'm experiencing an issue with screen sharing on Mac Safari Version 18.0.1 (20619.1.26.31.7). After clicking "Cancel" on the initial screen share permission dialog, all subsequent screen sharing attempts fail with the following error: Device type: Mac Attempted multiple screen share initiations Below is the code snippet for the screen sharing implementation:
javascriptCopy{type: 'INVALID_OPERATION', reason: 'user deny screen share'}
Here are the relevant details:
Browser: Safari 18.0.1 (20619.1.26.31.7)
Error code: INVALID_OPERATION
Troubleshooting steps taken:
Verified the issue occurs consistently after initial denial
javascriptCopytoggleShare(isShare) {
if (isShare) {
if (mediaStream.isStartShareScreenWithVideoElement()) {
mediaStream.startShareScreen(document.querySelector('#chat-share-video')).then(() => {
$("#chat-shareVideoContainer").show();
$("#chat-shareCanvasContainer").removeClass("flex-align-items-center");
$("#chat-shareCanvasContainer").hide();
}).catch((error) => {
adapter.server.SendSysMessage(adapter.currentIceLink.conversationId, "resetShareScreen", (res) => {});
console.log('error =>', error)
})
} else {
mediaStream.startShareScreen(document.querySelector('#chat-share-canvas')).then(() => {
$("#chat-shareVideoContainer").hide();
$("#chat-shareCanvasContainer").addClass("flex-align-items-center");
$("#chat-shareCanvasContainer").show();
}).catch((error) => {
adapter.server.SendSysMessage(adapter.currentIceLink.conversationId, "resetShareScreen", (res) => {});
console.log('error =>', error)
})
}
} else {
mediaStream.stopShareScreen().then(() => {
adapter.server.SendSysMessage(adapter.currentIceLink.conversationId, "resetShareScreen", (res) => {});
$("#chat-shareVideoContainer").hide();
$("#chat-shareCanvasContainer").removeClass("flex-align-items-center");
$("#chat-shareCanvasContainer").hide();
}).catch((error) => {
console.log('error =>', error)
})
}
}
Show less