how to enable screen/desktop capture in chrome? - javascript

I am able to achive it in firefox by folowing below steps:
make my server https
append my domain to the user preference media.getusermedia.screensharing.allowed_domains in about:config to whitelist it for screen sharing.
use constraint like {video: {mediaSource: "screen"}},
but in chrome, I am getting totally lost.
most places keep telling: You'll need to first enable the flag called Enable screen capture support in getUserMedia() in chrome://flags. ( but I am unable to find this flag anywhere)
I have checked Muaz Khan's screen share plugin, it works great, but afraid that it is coupled with other WebRTC experiment projects, and I am not sure how to customize the plugin to my project.
At this junction, I have come to an understanding that, without plug-in or flags, cannot capture the desktop mediastream.
so what I would like to know is, what is the flag I must enable/ what must be part of a plug-in written from scratch to make chrome support capturing desktop the same way it allows us to capture camera.

In Chrome/Chromium you cannot use "standard" Javascript to capture users screen anymore.
It was replaced by the chrome.desktopCapture API, which is exclusive for Chrome extensions.
The example you're providing rely in this API and an extensions. It's plugin free but not extension free.

The enable-usermedia-screen-capture flag was removed from chrome://flags/ in Chrome M36 (Chromium Issue 347641).
For testing or experimenting, the feature can still be enabled when starting Chrome with chrome --enable-usermedia-screen-capturing (tested in Chrome 68).
Screenshot:
The Chrome Platform Status also highlights a MediaStream.getDisplayMedia() implementation, which will allow developers to record or share the screen from the browser without any plugin. The specification for this can be found in the Screen Capture Editor's Draft.

Related

Change browser from Edge to IE with Javascript

I'm working on a website where (due to security settings in the users Windows desktops), the users cannot use the Edge browser.
Is there a work-around where I can 'redirect' the website to use Internet Explorer? In other words, ask it to perform the equivalent of run Internet explorer as an app and go to the same URL?
We will fix the issues on the website, but I don't want to get into the issues here, thanks.
-----edit-----
In this case the users have pre-packaged Windows 10 with non-standard security settings for Edge. Sadly I don't have control over the windows build and in a large company there are a number of hurdles before the corrected settings can be applied.
It's all well and good to let users choose their own browsers in normal situations, but in this specific case a solution is required.
I am happy to create a temporary "please use Internet Explorer page" but I was hoping a mime application type or other solution could suggest to the windows pc to run IE along with the same url the user is first accessing to make this more seamless.
Sites can't control whether to use IE11 or Edge, however Microsoft does allow specific sites to be white listed to only use IE11 using Group Policy. Here is Microsoft's page talking about it: https://technet.microsoft.com/en-us/itpro/microsoft-edge/emie-to-improve-compatibility

Chrome extension that changes values in the Preferences file

I'm trying to write a chrome extension that auto-hides the bookmark bar and shows it when you hover over that area. I was able to do this through c++ by listening to the cursor location and using the ctrl-shift-b shortcut. Unfortunately this is not feasible using the extensions API so I'll have to find another solution.
Would it be possible to do this by changing the value of show_on_all_tabs to true in Preferences?
"bookmark_bar":{"show_apps_shortcut":false,"show_on_all_tabs":false}
If so, then how would I go about implementing that in my extension?
Thanks
There's no API available to Google Chrome extensions to change/hook/control the browser UI.
Other Chromium-based browsers may have something of the kind like Opera's sidebar API.
Changing any of the internal files like the Preferences is also not allowed. It's hard to change even externally as you'd need to change Secure Preferences too, properly updating its hashsum.
Sending Ctrl+Shift+B hotkey from inside an extension/webpage is fruitless as well as it will never escape the content sandbox, and won't reach the browser's internal event listener.

Firefox displays DRM warning on Azure Media Player without DRM active

I'm working on an adaptive streaming solution for video out of Azure Media Services. On the client side, I'm using Azure Media Player.
Everything seems to be working fine on all the major browsers. However, Firefox pops up a yellow warning when loading the JS file that drives Microsoft's player. This warning appears even without a <video> tag on the page.
Here's a screenshot.
Can this be disable? I know I can in my Firefox, but I need my users to not see this warning. As you can see, the video IS playing anyway.
When AMP sets up it needs to query the platform capabilities to make a correct decision which tech to use. AMP is simply querying an API if it exists or not. Firefox, has decided that if you query any DRM support, even if you aren’t using it, you are forced to see this message. The message itself is a misnomer from Firefox.
This is a known issue and Microsoft is working on it.

Launch Chrome browser from Internet Explorer

We have a web application which has some features that works only in Chrome and I want to launch this web app using Google chrome browser with url of the web app as parameter from Internet explorer via a hyperlink. I tried
file:///C:/Program%20Files%20(x86)/Google/Chrome/application/chrome.exe
but it downloads the file + how do I add parameter to the exe.
By default, a browser cannot launch another program (plugins and extensions being possible exceptions). If they could, imagine the havoc some malicious user could get up to.
I don't think there's going to be a great answer for this, but you could make a .bat file that opens chrome to a particular URL (assuming you're using Windows), download that and click on it after it downloads.
Here is a useful answer in that case.
You could also (theoretically) make an extension or lower the security settings on IE to allow ActiveX controls. Here's a partial solution. I tried to make something similar a while back and didn't have much luck, but if you're determined...
Maybe there's a better way that doesn't involve such complicated solutions?
I found myself needing to achieve this myself. It appears a later release of Chrome had broken the fix described in Adam Fowlers blog.
I got in touch with him and he's now updated his post, providing the now necessary registry changes required to make this work.
I've tried this myself and it works nicely.
Adam Fowlers blog post - How to launch a URL in Google Chrome
https://www.adamfowlerit.com/2015/05/how-to-launch-a-url-in-google-chrome/
Big thanks to Adam for his time! Hope this helps.
This is a .reg file that creates (on a 64-bit Windows) a special URL protocol that allows you to open chrome: links in Chrome:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\chrome]
#="Chrome URL Prorocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\chrome\Application]
"ApplicationIcon"="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe,0"
"ApplicationName"="Google Chrome"
"ApplicationDescription"="Access the Internet"
"ApplicationCompany"="Google LLC"
[HKEY_CLASSES_ROOT\chrome\DefaultIcon]
#="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe,0"
[HKEY_CLASSES_ROOT\chrome\shell]
[HKEY_CLASSES_ROOT\chrome\shell\open]
[HKEY_CLASSES_ROOT\chrome\shell\open\command]
#="cmd /v:on /c \"set url=%1 & set url=!url:chrome:=! & \"\"\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"\"\" -- !url!\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute\chrome]
"WarnOnOpen"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ProtocolExecute\chrome]
"WarnOnOpen"=dword:00000000
Links should be like chrome:https://google.com or chrome:google.com. "chrome:" part is removed before launching Chrome.
You can use a URI Scheme, Google installs one by default as shared by Adam Fowler here:
http://www.adamfowlerit.com/2015/05/28/how-to-launch-a-url-in-google-chrome/
So you can create a link like this (note the space before the URL):
ChromeHTML:// www.bbc.co.uk
But it is broken! There's a bug report with Google, see Adam's article. It would be good to add some weight/comments to this bug if you want it fixed.
However your next decision depends on whether you have some control over the deployment of your web application because these bugs can be fixed using registry fixes.
Interestingly, if you can deploy registry fixes, in theory you could create your own URI schemes.
If you can modify the IE permissions on the PCs needed, you can use a javascript link to launch a process. Mine launches a custom program that launches chrome with command line switches and a URL, or opens a web page that indicates they need to contact IT to install Chrome on their PC:
javascript:(new ActiveXObject('Shell.Application')).ShellExecute('\\\\server\\path\\LaunchInChrome.exe', '-incognito --use-system-default-printer https://outlook.office365.com/owa/?realm=xxx http://webserver/MissingChrome.html');
But you could modify it to launch chrome.exe directly instead. You will need to enable Initialize and script ActiveX controls not marked as safe for scripting in the Intranet Zone (I wouldn't recommend this for any other zone).
you have to pass the parameter to chrome, something like this.
start chrome https://www.google.com/

Linking users to chrome flags page

I've created a site that utilizes the new Web Midi Api, native in Chrome Canary.
Since web midi isn't enabled by default, I would like to simply direct my users to chrome://flags/#enable-web-midi where they can enable midi.
I discovered that using an anchor tag isn't allowed, nor is window.open("chrome://flags"). I'm wondering if there is a Chrome expert out there who could steer me in the right direction.
I want to make this enabling step as easy as possible for my users.
chrome.tabs.create({url: "chrome://flags#enable-web-midi"});
This does not require any permission. (This assumes you are developing a Chrome app, if you are making a normal site, then I don't think it's possible.)
Details on chrome.tabs.create.

Categories

Resources