I have made an application to record a video by following this steps : https://github.com/muaz-khan/RecordRTC,
I want access to allow the camera always 'allow',
i've tried bypass the allow permission in popup allow webcam use start chrome --use--fake-ui--for--media-stream and it's work for me, but when i closed my chrome and then i opened chrome again , the popup permission allow webcam still showing,
what's the solution?
If you serve your application from an https domain, Chrome will remember the user's answer to the permissions dialog after the first use, so if they use it once, permission is granted (they click "allow"), the next time they use it, permission will be granted automatically and they won't be shown the pop up again.
Related
I'm working on developing a chrome extension that adds the ability to users to stream videos from any website they want by using Agora SKD. What the extension supposed to do is showing the streaming video screen inside the opened tab. I'm using Agora library to stream the videos.
Agora library requests media permissions(camera and microphone) for the opened website; If the user was on w3schools.com website, then media permissions will be granted to w3schools.com website.
Granting media permission to every website I need to inject my javascript code in and start video streaming on is not something very wise, because those websites can run scripts in the future that will access user's camera and microphone. That's why I'm looking for a way to limit websites access to those permissions.
The first way I thought in to show the video stream inside the tab without granting w3schools website media permission is embedding the video stream code in another website owned by my chrome extension mywebsite.com, grant my website the media permission and display my website within w3schools.com. I tried to put my website mywebsite.com inside a frame within w3schools.com website and ask for permission from my website. This doesn't work cause Chrome grants the permission to w3schools.com website and passed the permission to the frame that running my website.
<!--Allow camera and microphone access within the context of this iframe-->
<iframe src="https://mywebsite.com" allow="camera;microphone"></iframe>
<!--Other content of w3schools.com goes here-->
I tried to also look for a way to grant w3schools.com website media permissions temporarily and revoke the permissions after the video streaming is over but I couldn't find any way to do that.
I didn't find any way to revoke/reset the permissions using JS.
I didn't find any way to revoke/reset the permissions using chrome extension api interface.
I didn't find anyway to temporarily grant the media permission to a tab(until it's closed or for a certain time).
I didn't find anyway to access chrome://settings/content/siteDetails?site=https%3A%2F%2Fwww.w3schools.com and change the website permission from there.
So my questions are:
How can I revoke the media permissions access for a website using chrome extensions?
Is there a way where I can load my website https://mywebsite.com within w3schools.com and request the media permissions to https://mywebsite.com instead of w3schools.com?
This is by no means a complete answer, but I did some research to help you out.
Permissions.revoke() is deprecated
Seems like there used to be Permissions.revoke() functionality, but it has been deprecated for some reason: https://developer.mozilla.org/en-US/docs/Web/API/Permissions/revoke
There is a community draft for relinquishing permissions
I bumped into this W3C Community Draft about Revoke API: https://wicg.github.io/permissions-revoke/
Extensions have permission pages
Seems like extensions have permission pages. For example, I went to my Chrome's extensions page a chose Google Keep Chrome Extension for this:
I copied the id extension ID lpcaedmchfhocbbapmcbpinfpgnhiddi and made the following URL out of it:
chrome://settings/content/siteDetails?site=chrome-extension://lpcaedmchfhocbbapmcbpinfpgnhiddi
And this brought me to the following page:
I don't know if there is any use for this, but I thought it was interesting.
Exploiting chrome://settings/content/siteDetails reset-button functionality
I (also) tried to figure out what does Chrome's website permissions page do in order to revoke the permissions, but couldn't find an answer. I've actually tried to do something similar before and speaking from experience, something like this will most likely not work, e.g. Chrome has this stuff figured out and does not allow calling certain "system functions" from any page - that would make no sense.
The iframe idea won't work
Iframe's allow-attribute only delegates permissions from the parent page.
Your options
As far as I can tell right now, I believe your options are to either ignore the issue, find a way to disable Agora needing those permissions (if you only need to stream videos from websites, where do you need microphone or webcam anyway?), or replace Agora with something else - by utilizing the Media Streams API, this should be relatively simple.
In my page I have three audio recorders. And when chrome asks permission to use the mic, it has the options: "allow", "block" and to close the permission popup.
If the use closes de popup, it appears other permission, and after that another (if the user repeats the action). One for each recorder.
Is there a way to show this only one time?
If you have multiple microphones or cameras, you can choose which one to use as the default device for chrome.
Follow these steps: Open Chrome -> settings -> Privacy and security -> Site Settings -> Microphone -> Choose the microphone you need to use
Open Chromium Edge -> settings -> cookies and site permissions -> Microphone -> Choose which microphone the browser can access
Or you can set whether to allow the use of the microphone for each website, through the site settings on this page.
As I was using react-media-recorder, I tried to see if it was a bug in the lib. And it happened that the recorder was asking permission on mounting.
I changed this to ask only when the user click to record.
So if anyone has the same problem (even if you don't use this lib) try the same thing.
I am trying to make a chrome extension where I need access to the webcam feed once the user has allowed permission and has toggled on button in the extension popup. The feed should (and the extension) should keep running persistently until the user has stopped the feed via the control in the popup or has exited chrome.
Unfortunately, there's not sufficient information as to how to do this, let alone access webcam from the extension. I did read the related answer where its mentioned to use content scripts but there's no example code for it. (And no documentation as well).
Also, unfortunately I don't have enough working code to give insight of my progress.
Chrome has recently released an update to its media settings which prompts a user to grant permission to a site allowing access to his/her microphone and camera. Is there a way to detect these settings in Javascript?
I have a flash player (which will eventually be HTML5 based) with microphone functionality. The player is currently set up with a friendly tutorial on how to grant permission before starting the session. However, since Chrome released the update, the flash player and Chrome permissions are conflicting causing an error in the flash until the user has allowed/denied the Chrome settings prompt. What I'd like to do, until the player is moved to HTML5, is detect if the browser is Chrome (with appropriate version) and if the user's settings aren't set to then show additional tutorial screen.
Couple things:
This is specific to Chromes implementation so you can not tell what permissions the user has granted unless Chrome supplies that information to your app. I.E. there is no API you can query for this info.
It's not even something that Chrome stores. If you look under the advanced settings tab on this page, you will see that its on a per app basis not a one time thing. Chrome will only remember what permission was granted for a specific application if that app asks for the permission over https. If it asks for it over http then it will forget what permissions were granted.
Your best bet (though by no means full-proof) is to sniff out the browser agent and version. For one of the better implementations of this see here.
You will want to specifically look for Chrome and any version >= 21. (21 was the version that introduced the getMediaApi). Then it's a simple if check:
if (version >= 21){
//ask permission though the getMediaApi
} else{
//ask permission though flash
}
i stumbled into an approach for this that works fairly well, and doesn't require cookies (people can change these settings out-of-band, so the cookie can become incorrect), or for Chrome to provide an ounce of help (it doesn't).
if (chrome) {
var madeMicDecision = false;
navigator.getUserMedia({whatever},
function(stream) {
madeMicDecision = true;
//close the stream, move to the next page
//they have either just granted permission, or have in the past and it's remembered
},
function(error) {
madeMicDecision = true;
//go to error handling page
//the error handling page should describe going to chrome://settings/contentExceptions#media-stream
//or how to allow the user media via clicking on the crossed out camera icon in the 'wonderbar'
}
}
But we also want to show the tutorial screen - the above code will pop the chrome infobox if the permission setting isn't remembered. But without permission events from chrome, or an API to query permissions, how do we know when to show the chrome+infobox tutorial content?
My trick was to show the content automatically, but only after a delay. People who have accepted or denied permissions previously would never see this content, because our success/error handler would have moved them on before the delay. So, give the getUserMedia call a moment to detect/react - if the browser hasn't moved on, it's time to show the help content.
setTimeout(function() {
if (!madeMicDescision) {
//display chrome/infobox/getUserMedia permissions help content
}
}, 2000);
Not perfect (bizarre and sad really), but seems to work for the most common cases.
I cloned a project about real-time image processing on a web browser from this link:
Then I could not allow my browser to access my camera.
I got this javascript alert:
Uh-oh, the webcam didn't start. Do you have a webcam? Did you give it
permission? Refresh to try again.
And the allow button is not shown as if I access his site.
To ignore Chrome’s secure origin policy, follow these steps.
Navigate to chrome://flags/#unsafely-treat-insecure-origin-as-secure in Chrome.
Find and enable the Insecure origins treated as secure section (see below).
Add any addresses you want to ignore the secure origin policy for. Remember to include the port number too (if required).
Save and restart Chrome.
I found solution from below link.Hope it will help to someone
https://medium.com/#Carmichaelize/enabling-the-microphone-camera-in-chrome-for-local-unsecure-origins-9c90c3149339
Are you accessing the webpage that is served over HTTP, on localhost? If you are accessing it from http://localhost/... , Chrome will ask for your permission to use the camera.
If you are opening the web page directly, i.e. /Users/Methuz/Documents/index.html then it will not work, even if you explicitly allows it permission
In this case, the workaround I use is to host the HTML file on a webserver. A quick hack is to use python, in the folder where the HTML page is lcoated: python -m SimpleHTTPServer
Step 1:
Find your chrome preferences file:
http://www.forensicswiki.org/wiki/Google_Chrome#Configuration
Step 2:
Open it and Find the "profile" key
Step3:
Under profile there will be a "content_settings" hash, that will have a "pattern_pairs" hash
Add this to it:
"*,*": {
"media-stream-camera": 1
}
Final example:
"profile": {
....
"content_settings": {
....
"pattern_pairs": {
"*,*": {
"media-stream-camera": 1
},
....
}
}
}
WARNING: This will allow all websites access to your camera
Chrome now only allows https:// servers to persistent list (version 39.xx)
https://support.google.com/chrome/answer/2693767?hl=en
Allow: This allows the site to access your camera and microphone at this time and a notification will appear confirming that you’ve granted access. If you select Allow on a "http" URL your preference will not be remembered in future visits. If you select Allow on a "https" URL, your preference will be remembered in future visits.
Maybe this link helps to set your local secure server if you are using Wamp.
http://forum.wampserver.com/read.php?2,32986
Then you can add your local server to persistent allow list of chrome.
Got this problem for days, only this helped:
Reinstall Chrome by removing configuration as well. And try not to sync all the extensions, as they may interfere.
sudo apt-get purge google-chrome-stable
rm -rf ~/.config/google-chrome
Then install from official.
Another solution is to use iframe tag. Jest deploy your page on server (localhost or external) and include it in your local html.
Example:
<iframe src="http://localhost/your_project/index.html"></iframe>
Chrome on HTTP or any other port won't save the preference of Camara share choice.
To save the selection you will need to run on HTTPs, even if you don't have SSL certificate on localhost that fine. Just add https before the localhost url and it will ask you its unsafe, if you want to proceed add it as an exception under Advance options. Do that and then Chrome will save you camera sharing preference for this website. and won't ask you to select allow
You can choose a different default permission setting and manage exceptions in Content settings.
Click the Chrome menu Chrome menu on the browser toolbar.
Select Settings.
Click Show advanced settings.
In the "Privacy" section, click Content settings.
In the "Media" section:
* Ask me when a site requires access to my camera and microphone: Select this option if you want Chrome to alert you whenever a site requests access to your camera and microphone.
* Do not allow sites to access my camera and microphone: Select this option to automatically deny any site requests to access your camera and microphone.
Or click Manage exceptions to remove previously-granted permissions for specific sites.
Source: https://support.google.com/chrome/answer/2696491?hl=en
P/D: the link you provided has an error. I can't access.
Open localhost/webcam.swf
then right click on the flash file then allow the webcam and tick remember
that will add exception for localhost