Add an override for web.snapchat.com
Categories
(Web Compatibility :: Interventions, enhancement)
Tracking
(Not tracked)
People
(Reporter: ksenia, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
|
2.64 MB,
image/png
|
Details |
There are reports suggesting that web.snapchat.com works fine in Firefox with Chrome UA, so we can test and ship an override for desktop.
| Reporter | ||
Comment 1•2 years ago
|
||
I've tried using the web version with spoofed UA and the chat feature seems to work, though there is this “click the camera to send snaps” on the main page that doesn’t work in Firefox.
I’m getting this error “Uncaught (in promise) TypeError: ‘camera’ (value of ‘name’ member of PermissionDescriptor) is not a valid value for enumeration PermissionName.“ which is bug1609427. We could probably try shimming this api, but that would require more time and likely won't happen in this release.
| Reporter | ||
Comment 2•2 years ago
|
||
(In reply to Ksenia Berezina [:ksenia] from comment #1)
I've tried using the web version with spoofed UA and the chat feature seems to work, though there is this “click the camera to send snaps” on the main page that doesn’t work in Firefox.
I’m getting this error
“Uncaught (in promise) TypeError: ‘camera’ (value of ‘name’ member of PermissionDescriptor) is not a valid value for enumeration PermissionName.“which is bug1609427. We could probably try shimming this api, but that would require more time and likely won't happen in this release.
You can make this part of the site work with this javascript code
if ('permissions' in navigator && typeof navigator.permissions.query === 'function') {
const originalQuery = navigator.permissions.query;
navigator.permissions.query = function(query) {
if (query.name === 'camera' || query.name === 'microphone') {
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
return new Promise(function(resolve, reject) {
navigator.getUserMedia({ audio: true, video: true }, function() {
resolve({ state: 'granted' });
}, function() {
resolve({ state: 'denied' });
});
});
} else {
return originalQuery.call(navigator.permissions, query);
}
};
}
present in https://addons.mozilla.org/fr/firefox/addon/snapchatweb/
| Reporter | ||
Comment 4•2 years ago
|
||
You can make this part of the site work with this javascript code
Thanks for your comment, this is helpful! I've tried shimming navigator.permissions.query and the camera/snaps starts working.
I was testing other parts of the app, and noticed that calls to other users don't work. When trying to make a call, I receive it at the other end, but not able to connect and the call just ends. There are no obvious errors in the console, so I'm not sure what's causing this, perhaps the way they're establishing webrtc connection is not supported in Firefox. This needs additional investigation, I'll look into it when I have some spare cycles.
| Reporter | ||
Comment 5•2 years ago
|
||
Just so this doesn't get lost, the following intervention makes camera and snaps working:
const win = window.wrappedJSObject;
const nav = navigator.wrappedJSObject;
const proto = window.Permissions.prototype.wrappedJSObject;
const queryDesc = Object.getOwnPropertyDescriptor(proto, "query");
const originalQuery = queryDesc.value;
const returnValue = { state: "granted" };
queryDesc.value = exportFunction(function (args) {
if (args?.name === "camera" || args?.name === "microphone") {
return win.Promise.resolve(
cloneInto(returnValue, window, {
cloneFunctions: true,
})
);
}
return originalQuery.call(nav.permissions, args);
}, window);
Object.defineProperty(proto, "query", queryDesc);
| Reporter | ||
Updated•2 years ago
|
| Reporter | ||
Updated•1 year ago
|
Description
•