-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(mac): expose getDisplayMedia() permission decision handler #1196
base: dev
Are you sure you want to change the base?
Conversation
1c1695e
to
1e562dd
Compare
1e562dd
to
90a5447
Compare
src/wkwebview/mod.rs
Outdated
(14, 0, _) => { | ||
// Do not suppress media request on 14.0: | ||
// https://github.com/tauri-apps/wry/issues/1101 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(14, 0, _) => { | |
// Do not suppress media request on 14.0: | |
// https://github.com/tauri-apps/wry/issues/1101 | |
} | |
(14, 0, _) | (14, 1, _) => { | |
// Do not suppress media request on 14.0 & 14.1: | |
// https://github.com/tauri-apps/wry/issues/1101 | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(just blocking this because of ongoing discussion in #1195)
@FabianLars Your private API (or maybe just not document yet?) hint is mega helpful After I read some WebKit source code bool respondsToRequestMediaCapturePermission = [delegate respondsToSelector:@selector(webView:requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler:)];
bool respondsToRequestUserMediaAuthorizationForDevices = [delegate respondsToSelector:@selector(_webView:requestUserMediaAuthorizationForDevices:url:mainFrameURL:decisionHandler:)];
bool respondsToRequestDisplayCapturePermissionForOrigin = [delegate respondsToSelector:@selector(_webView:requestDisplayCapturePermissionForOrigin:initiatedByFrame:withSystemAudio:decisionHandler:)]; I guess they are using The reason why it's not working on your commit is because the typo LOL - _webView:requestDisplayCapturePermissionForSecurityOrigin:initiatedByFrame:withSystemAudio:decisionHandler:
+ _webView:requestDisplayCapturePermissionForOrigin:initiatedByFrame:withSystemAudio:decisionHandler: But it's still not showing the window / screen select panel, just window OR screen. |
nooo, not a freaking typo, I just can't 😂 |
Just update the implementation, will expose a closure and let them pick the decision |
Maybe it can just store the decision instead of a closure, since there's only a capture type parameter? |
} | ||
} | ||
|
||
pub(crate) fn drop_decision_hanlder(webview: *mut Object) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub(crate) fn drop_decision_hanlder(webview: *mut Object) { | |
pub(crate) fn drop_decision_handler(webview: *mut Object) { |
(the usages of this function have the same typo)
I'm not 100% sure i really understand. When we use a variable only the developer could decide right? The good thing about the handler is that wkwebview will call that itself and then the dev can implement something that will let the actual app user decide if they want a screen or window prompt. I don't see how we could mimic this with just a variable. |
In this case, the developer will need to implement something like a prompt to let the user choose to capture a screen or a window and call a setter like Closure is good and may not need an extra set step like the variable approach. But I think it will be a bit more complicated managing the lifetime and ownership when implementing logic inside the closure. |
Hmm, another problem that comes to mind is that this makes it harder for use cases where you load external websites that you don't control since then you don't really know when you ask the user what they want to share. I still think this is still a bit of a problem even if it's your website because then you have to communicate between js and rust to know when to prompt the user.
Hmm, yeah that could be a problem. I thought/hoped that the main thing to do here would be to simply call rfd in that closure and leave it at that 🤔 |
Related issue: #1195
Temporary fix for the issue. Needs to find the affected range in the future.