Event Listener to know when camera or microphone is executing throw web browser












0















I am building a chrome extension. The task of the extension is to notify user that what resource/service (camera/microphone/location) is on when he visit a site.for https sites chrome browser can remember them when a user allow for a resource. I want to build some code or logic that when a camera or microphone or location (that is allowed before by user) is using by a site i want to notify this.



Ex. one visits a https website.website asked camera permission for capturing profile picture. Later website may take a snapshot or video stream on. this time no prompt will fire as this resource allowed before. I want to notify this use. for a allowed service or resource whenever he uses i want to notify.



I go through chrome developer site, MDN & stack-overflow but nothing or did not pick the right section.Can anyone help me about this? How can i do this?










share|improve this question

























  • Not in the chrome:// side of the Force, but wouldn't it be easier to force the settings to be "Always ask" instead of trying to listen to all calls? Otherwise, I guess it won't be that easy, you'll probably have to overwrite all default getters (like MediaDevices.getUserMedia) and hook a listener on it which should map which device got requested (implies a MediaConstraint parser), and then to hook on the returned stream and all the clone that could get created in order to know when they are released...

    – Kaiido
    Jan 2 at 5:26













  • @Kaiido yes that will be best decision. but if you see there is no option to allow once. if you use facebook messenger video call.you have to allow camera & mic (will forever until change) . one may not enough smart to toggle the permission after use.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:34











  • Yes but I mean for your extension, it might be easier for it to modify the registry of allowed websites so it is always clear and that the prompt is always shown to the users of your extension. Seems to achieve the same end-goal, in a more robust and probably easier to implement way.

    – Kaiido
    Jan 2 at 5:37











  • developer.chrome.com/extensions/contentSettings sounds like what you need no?

    – Kaiido
    Jan 2 at 5:43











  • yes i read all there. I already add feature to modify permission. Your idea is much easier and goal oriented. Still want to cover those situation one may continue to allow. but that case notification of every use can confirm user resource-use is valid.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:51
















0















I am building a chrome extension. The task of the extension is to notify user that what resource/service (camera/microphone/location) is on when he visit a site.for https sites chrome browser can remember them when a user allow for a resource. I want to build some code or logic that when a camera or microphone or location (that is allowed before by user) is using by a site i want to notify this.



Ex. one visits a https website.website asked camera permission for capturing profile picture. Later website may take a snapshot or video stream on. this time no prompt will fire as this resource allowed before. I want to notify this use. for a allowed service or resource whenever he uses i want to notify.



I go through chrome developer site, MDN & stack-overflow but nothing or did not pick the right section.Can anyone help me about this? How can i do this?










share|improve this question

























  • Not in the chrome:// side of the Force, but wouldn't it be easier to force the settings to be "Always ask" instead of trying to listen to all calls? Otherwise, I guess it won't be that easy, you'll probably have to overwrite all default getters (like MediaDevices.getUserMedia) and hook a listener on it which should map which device got requested (implies a MediaConstraint parser), and then to hook on the returned stream and all the clone that could get created in order to know when they are released...

    – Kaiido
    Jan 2 at 5:26













  • @Kaiido yes that will be best decision. but if you see there is no option to allow once. if you use facebook messenger video call.you have to allow camera & mic (will forever until change) . one may not enough smart to toggle the permission after use.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:34











  • Yes but I mean for your extension, it might be easier for it to modify the registry of allowed websites so it is always clear and that the prompt is always shown to the users of your extension. Seems to achieve the same end-goal, in a more robust and probably easier to implement way.

    – Kaiido
    Jan 2 at 5:37











  • developer.chrome.com/extensions/contentSettings sounds like what you need no?

    – Kaiido
    Jan 2 at 5:43











  • yes i read all there. I already add feature to modify permission. Your idea is much easier and goal oriented. Still want to cover those situation one may continue to allow. but that case notification of every use can confirm user resource-use is valid.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:51














0












0








0








I am building a chrome extension. The task of the extension is to notify user that what resource/service (camera/microphone/location) is on when he visit a site.for https sites chrome browser can remember them when a user allow for a resource. I want to build some code or logic that when a camera or microphone or location (that is allowed before by user) is using by a site i want to notify this.



Ex. one visits a https website.website asked camera permission for capturing profile picture. Later website may take a snapshot or video stream on. this time no prompt will fire as this resource allowed before. I want to notify this use. for a allowed service or resource whenever he uses i want to notify.



I go through chrome developer site, MDN & stack-overflow but nothing or did not pick the right section.Can anyone help me about this? How can i do this?










share|improve this question
















I am building a chrome extension. The task of the extension is to notify user that what resource/service (camera/microphone/location) is on when he visit a site.for https sites chrome browser can remember them when a user allow for a resource. I want to build some code or logic that when a camera or microphone or location (that is allowed before by user) is using by a site i want to notify this.



Ex. one visits a https website.website asked camera permission for capturing profile picture. Later website may take a snapshot or video stream on. this time no prompt will fire as this resource allowed before. I want to notify this use. for a allowed service or resource whenever he uses i want to notify.



I go through chrome developer site, MDN & stack-overflow but nothing or did not pick the right section.Can anyone help me about this? How can i do this?







javascript google-chrome-extension event-listener getusermedia






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 5:34









Kaiido

44.3k467107




44.3k467107










asked Jan 2 at 5:20









Mohammad Sadiqur RahmanMohammad Sadiqur Rahman

1,68762134




1,68762134













  • Not in the chrome:// side of the Force, but wouldn't it be easier to force the settings to be "Always ask" instead of trying to listen to all calls? Otherwise, I guess it won't be that easy, you'll probably have to overwrite all default getters (like MediaDevices.getUserMedia) and hook a listener on it which should map which device got requested (implies a MediaConstraint parser), and then to hook on the returned stream and all the clone that could get created in order to know when they are released...

    – Kaiido
    Jan 2 at 5:26













  • @Kaiido yes that will be best decision. but if you see there is no option to allow once. if you use facebook messenger video call.you have to allow camera & mic (will forever until change) . one may not enough smart to toggle the permission after use.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:34











  • Yes but I mean for your extension, it might be easier for it to modify the registry of allowed websites so it is always clear and that the prompt is always shown to the users of your extension. Seems to achieve the same end-goal, in a more robust and probably easier to implement way.

    – Kaiido
    Jan 2 at 5:37











  • developer.chrome.com/extensions/contentSettings sounds like what you need no?

    – Kaiido
    Jan 2 at 5:43











  • yes i read all there. I already add feature to modify permission. Your idea is much easier and goal oriented. Still want to cover those situation one may continue to allow. but that case notification of every use can confirm user resource-use is valid.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:51



















  • Not in the chrome:// side of the Force, but wouldn't it be easier to force the settings to be "Always ask" instead of trying to listen to all calls? Otherwise, I guess it won't be that easy, you'll probably have to overwrite all default getters (like MediaDevices.getUserMedia) and hook a listener on it which should map which device got requested (implies a MediaConstraint parser), and then to hook on the returned stream and all the clone that could get created in order to know when they are released...

    – Kaiido
    Jan 2 at 5:26













  • @Kaiido yes that will be best decision. but if you see there is no option to allow once. if you use facebook messenger video call.you have to allow camera & mic (will forever until change) . one may not enough smart to toggle the permission after use.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:34











  • Yes but I mean for your extension, it might be easier for it to modify the registry of allowed websites so it is always clear and that the prompt is always shown to the users of your extension. Seems to achieve the same end-goal, in a more robust and probably easier to implement way.

    – Kaiido
    Jan 2 at 5:37











  • developer.chrome.com/extensions/contentSettings sounds like what you need no?

    – Kaiido
    Jan 2 at 5:43











  • yes i read all there. I already add feature to modify permission. Your idea is much easier and goal oriented. Still want to cover those situation one may continue to allow. but that case notification of every use can confirm user resource-use is valid.

    – Mohammad Sadiqur Rahman
    Jan 2 at 5:51

















Not in the chrome:// side of the Force, but wouldn't it be easier to force the settings to be "Always ask" instead of trying to listen to all calls? Otherwise, I guess it won't be that easy, you'll probably have to overwrite all default getters (like MediaDevices.getUserMedia) and hook a listener on it which should map which device got requested (implies a MediaConstraint parser), and then to hook on the returned stream and all the clone that could get created in order to know when they are released...

– Kaiido
Jan 2 at 5:26







Not in the chrome:// side of the Force, but wouldn't it be easier to force the settings to be "Always ask" instead of trying to listen to all calls? Otherwise, I guess it won't be that easy, you'll probably have to overwrite all default getters (like MediaDevices.getUserMedia) and hook a listener on it which should map which device got requested (implies a MediaConstraint parser), and then to hook on the returned stream and all the clone that could get created in order to know when they are released...

– Kaiido
Jan 2 at 5:26















@Kaiido yes that will be best decision. but if you see there is no option to allow once. if you use facebook messenger video call.you have to allow camera & mic (will forever until change) . one may not enough smart to toggle the permission after use.

– Mohammad Sadiqur Rahman
Jan 2 at 5:34





@Kaiido yes that will be best decision. but if you see there is no option to allow once. if you use facebook messenger video call.you have to allow camera & mic (will forever until change) . one may not enough smart to toggle the permission after use.

– Mohammad Sadiqur Rahman
Jan 2 at 5:34













Yes but I mean for your extension, it might be easier for it to modify the registry of allowed websites so it is always clear and that the prompt is always shown to the users of your extension. Seems to achieve the same end-goal, in a more robust and probably easier to implement way.

– Kaiido
Jan 2 at 5:37





Yes but I mean for your extension, it might be easier for it to modify the registry of allowed websites so it is always clear and that the prompt is always shown to the users of your extension. Seems to achieve the same end-goal, in a more robust and probably easier to implement way.

– Kaiido
Jan 2 at 5:37













developer.chrome.com/extensions/contentSettings sounds like what you need no?

– Kaiido
Jan 2 at 5:43





developer.chrome.com/extensions/contentSettings sounds like what you need no?

– Kaiido
Jan 2 at 5:43













yes i read all there. I already add feature to modify permission. Your idea is much easier and goal oriented. Still want to cover those situation one may continue to allow. but that case notification of every use can confirm user resource-use is valid.

– Mohammad Sadiqur Rahman
Jan 2 at 5:51





yes i read all there. I already add feature to modify permission. Your idea is much easier and goal oriented. Still want to cover those situation one may continue to allow. but that case notification of every use can confirm user resource-use is valid.

– Mohammad Sadiqur Rahman
Jan 2 at 5:51












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001577%2fevent-listener-to-know-when-camera-or-microphone-is-executing-throw-web-browser%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001577%2fevent-listener-to-know-when-camera-or-microphone-is-executing-throw-web-browser%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith