Cannot read property 'chooseDesktopMedia' of undefined - webrtc

I am working on desktopCapture API of google chrome webrtc. When I run the application I am getting error "Cannot read property 'chooseDesktopMedia' of undefined". Means browser is not able to find the chrome.desktopCapture inside chrome browser.
My chrome browser version is 38.

Yep, access to the desktopCapture API is disabled by default. You either need to write an extension or modify the browsers internal flags.
I wrote such an example extension which might be helpful.

Related

How to run TestCafe tests with throttling connection?

I need to check functionality if a file is uploading longer then 1 minute.
To check it with manual testing I use Chrome Dev Tools to set Throttling "Slow 3G".
But I can't figure out how to do it with TestCafe.
TestCafe does not have an API to set the throttling. However, TestCafe uses Chrome DevTools Protocol internally so you can get access to internal CDP methods.
Please refer to the following links to get started:
Chrome DevTools Protocol
chrome-remote-interface package
chrome-remote-interface repo
Please also take a look at the following example which shows how to enable file downloading in chrome headless.
I think you need to combine this example with the CDP Network.emulateNetworkConditions method.
Please refer to this article https://chromedevtools.github.io/devtools-protocol/tot/Network#method-emulateNetworkConditions

understanding and/or troubleshooting XMLHttpRequest - No 'Access-Control-Allow-Origin' error

I am not an experienced web developer by any means, so I apologize if this is very basic / newb question. I did try researching this error message, but my skillset lies in different areas, so I was hoping someone could maybe give me a pointer.
We have a SWG (secure web gateway) inline that may or may not be causing this, since access works in IE, but not in Chrome - and the SWG just went inline recently - so am trying to find some root cause for this error.
here is the error message that I pull out of Chrome's Console debugger:
XMLHttpRequest cannot load .... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.youtube.com' is therefore not allowed access. The response had HTTP status code 403.
the "..." shows a URL that referes to a googlevideo.com link, but I am trying to view a video on youtube.com - any video for that matter.
seems that this is an XSS defense mechanism, but I dont see any blocks in the SWG, nor are some of the next-gen features even enabled
Chrome version - Version 51.0.2704.63 m (64-bit)
IE version - 11.0.9600.18314
any help is appreciated.
--disable-web-security now requires the use of the --user-data-dir flag.
Start-up your chrome with below command on windows:
chrome.exe --disable-web-security --user-data-dir
OR
Open Properties window of Google Chrome short cut icon available on desktop.
Go to the Shortcut tab
Specify the following flag at the end of path
"C:...\Application\chrome.exe" --disable-web-security --user-data-dir
Just specifying --disable-web-security --user-data-dir (without a value) worked for me.
If this didn't work for you then try specifying some folder path:
--user-data-dir=$HOME/path/to/some/folder

Strange getUserMedia issue?

I'm working on an html application that uses getUserMedia. It works great so far but there is one little problem:
The web application is also being called from local file system. That means file://.
Ok, WebRTC is unavailable in this case. When the Browser tries to call
navigator.getUserMedia({video: true, audio: false}, function(localMediaStream) {...}, function(error) {alert("blabla webrtc unavailable";)});
it should run into an error and call the error callback.
In case of file://, none of these two callbacks will be ever called.
In another case, the web application is running over regular http://, a warning is given, that the WebRTC feature is unavailable in insecure environments, but here the error callback is working as expected.
I need the error callback to tell the user, that WebRTC is unavailable.
What is wrong here?
(It is used for an unimportant feature. And only getUserMedia() is used, not the entire WebRTC-Workflow. But it is ugly, if it run into a blank screen)
And no, there is no waiting popup which ask the user for permission :-)
The problem is Chrome only. Probably a Browser bug?
Thanks.
Silently failing for file:// is documented Chrome behaviour, see here. If you can control Chrome, the allow-file-access-from-files flag enables getUserMedia from file urls.

getUserMedia API suport for Opera Local screen share

I am creating an Opera extension that will open a webpage which will allow user to stream a local window on to the browser html file. Since Opera extension structure is similar to the chrome, I tested the structure on Opera.
For manifest having permissons :
"permissions": ["desktopCapture","activeTab"],
Error :
There were warnings when trying to install this extension:
Permission 'desktopCapture' is unknown or URL pattern is malformed.
And for using the method :
chrome.desktopCapture.chooseDesktopMedia(["screen", "window"], onAccessApproved);
Console error :
Uncaught TypeError: Cannot read property 'chooseDesktopMedia' of undefined
Is there some documentation available for Opera regarding getUserMedia API usage that can help in the matter
Already gone through :
* https://dev.opera.com/articles/getusermedia-access-camera-privacy-ui/
* https://dev.opera.com/tags/getusermedia/
* WebRTC official page
The desktopCapture is not supported in Opera yet so you can't use it. There is no other way to share other application window I could see to work now.

Webkit audio Api createMediaElement Source

with reference to Working example for MediaElementAudioSourceNode with Chrome Canary?
anything ever came of this? I get a JS error
Uncaught TypeError: Object # has no method 'createMediaElementSource'
I'm using the latest chrome
It's now finally supported in Chrome 18 (currently Canary)!
See this article: HTML5Rocks Updates - HTML5 and the Web Audio API are BFFs!