Detects no microphone when using Chrome browser - actionscript-3

The code down bellow should detects the microphone. It works on all browser, but when i tested it on mac with latest google Chrome browser
the flash player initially detects that no microphone. But when i click on the "reload button" on the browser then it does detect the mic.
var mic:Microphone = Microphone.getMicrophone();
try {
prompt.text ="mic.name "+mic.name;
trace("mic.name "+mic.name)
} catch (e:Error) {
prompt.text ="no mic detected";
trace("no mic detected")
}
I heave searched google and spent many days trying to fix it... the only thing / way was to overcome this problem was to "reload" which is not that kind of fix we want.
Pleas help me out to fix it.. so it works like other browsers..

Related

window.addEventListener('unload', function () { } not working on Mac Safari. It works fine on Chrome

I'm trying to add bounce reporting for my landing page and have added the following code in Javascript (prefer to use pure Javascript).
window.addEventListener('unload', function () {
this.alert("unloading page");
reportBounce();
});
In reportBounce() I make an AJAX call to let the server know. I don't care about the response and am not showing a popup or anything.
The reportBounce fires up when on Chrome browser on Mac, but it does not fire when on safari on Mac. I am yet to try other browsers and OS combinations.
I've seen several questions, some talk about Back/Forward cache, some about Safari on IOS and using 'pagehide' instead of 'unload' but none that actually worked for Safari on Mac.
I was hoping there be a standard function that does the check for browser
and adds the correct event for this need.
Please advice on how to get this to work. Thanks!

Bug with screen sharing with RTCMulticonnection from Chrome to Mozilla

I am creating p2p application to share video and screen from Chrome to Mozilla. When I work with Chrome on both sides, it works fine. But when Mozilla is receiving screensharing video, I get a problem.
To start screenshare I do the following in Chrome:
connection.addStream({screen: true, oneway: true}
On the client side I have this callback:
connection.onstream = function (e) {
// handle input stream
}
With Mozilla this callback is not launched, but I see flickering on my main webcam stream: few frames from webcam and few frames from screenshare continiously.
How can I fix this? Is this Mozilla bug?
it you're adding more than one stream to a single peerconnection, you may be hitting the fact that Chrome and Firefox support different dialects of SDP.
Unless you do translation of the SDP, you'll have to use different peerconnections until the chrome bug is fixed.
My solution was migrating to SimpleRTC (http://simplewebrtc.com). This is same sort of library, but it is updated regularly to reflect browsers/API changes. The challange was signalling layer, because it uses special (opensource) library on top of socketio to handle chat rooms. But now screensharing works correctly.

video.onended + redirect not working in safari (only mac)

I've small problem which occurs only in Safari on Mac.
When video on this page http://tmp.vokracko.cz ends, it does not redirect as it should.
(And it work everywhere else, even in Safari on Windows)
Redirect code:
var video = document.getElementsByTagName('video')[0];
video.onended = function(e) {
window.location = window.location.href.substr(0, window.location.href.length - 10) + 'home.html';
};
Do you have any ideas why?
I can't test it and debug properly since I dont have a Mac.
According to W3C the event is endend, and not onended. But maybe all browers don't implement it.

Capturing images in web application on Windows 8.1 tablets

I am about to develop an application that is to run on Windows 8.1 tablets. An important feature is to be able to click on a button to access the camera to take some pictures. Ideally I would like to create it as a Web application rather than a native application due to a number of reasons (licences, cross-platform, development time: have no experience in native apps, etc.).
I have looked at the options for capturing images from HTML 5 and have found HTML Media Capture which allows me to write:
<input type="file" accept="image/*" capture="camera" />
To get access to the camera. This works great on iPads and on Android tablets, but I can't get it to work on Windows 8 tablets. I have tried using Chrome on the Windows 8 tablet, but still no effect. All it does is that it opens a file dialog in which I can choose a file to upload. What I want to do is to be able to capture a new image. This standard is not supported by IE (an apparently the other browsers cannot access the device's camera either).
I have also stumbled across Media Capture and Streams which seems to be mostly related to showing streams from e.g. the web cam, but probably could be used to capture images and is supported by Chrome and Firefox among other browsers, but still not by Internet Explorer (even IE11). None of the three browsers' implementations seem to work on my Windows 8.1 test machine though. If someone has gotten getUserMedia to work on Windows 8 tablets in any browser I'm interested in hearing about it.
Anyway, my main question is: Is there any way to access the camera on a Windows 8 tablet using HTML5 from a web application? The only working examples I have seen have relied on a prototype implementation for IE using Active X or solutions that use flash.
EDIT: I would very much prefer to keep it in HTML5/javascript as it has to work offline (using HTML5 Application Cache)
I struggled very much for this solution, at the end I find good a solution. But only can use in windows store apps like chrome windows 8 mode (chrome settings -> relaunch chrome in windows 8 mode) then you can use the normal file input tag in html. when you hit "choose file" u see the image below. Then u can choose camera to add take image from camera.
if you can not see camera in the list, u can install app below.
https://www.microsoft.com/en-US/store/apps/Camera-File-Open-Picker/9WZDNCRFJQVN
So I was running into the exactly same issue. My web app is similar, except I have to do some bar code scanning with the tablet's camera.
I'm using the HTML 5 media api as you commented. In order to make it work in chrome in a Windows 8 Surface Pro, I had to do this:
To enable getUserMedia in Chrome type ‘chrome://flags/’ in URL bar and enable “Enable screen capture support in getUserMedia(). Mac, Windows, Linux, Chrome OS” option.
It was working in my laptop but not in the tablet, after making that change and restarting chrome it worked. Good luck.
Here is the code I ended up using to get around this situation... It appears to work in chrome very well however still no support for Internet Explorer which is known not support getUserMedia. Again I wish this wasn't necessary and windows just supported the take picture feature like iOS and android but it works for now.
Credit:
http://davidwalsh.name/browser-camera
// Put event listeners into place
window.addEventListener("DOMContentLoaded", function() {
// Grab elements, create settings, etc.
var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"),
video = document.getElementById("video"),
videoObj = { "video": true },
errBack = function(error) {
console.log("Video capture error: ", error.code);
};
// Put video listeners into place
if(navigator.getUserMedia) { // Standard
navigator.getUserMedia(videoObj, function(stream) {
video.src = stream;
video.play();
}, errBack);
} else if(navigator.webkitGetUserMedia) { // WebKit-prefixed
navigator.webkitGetUserMedia(videoObj, function(stream){
video.src = window.webkitURL.createObjectURL(stream);
video.play();
}, errBack);
}
else if(navigator.mozGetUserMedia) { // Firefox-prefixed
navigator.mozGetUserMedia(videoObj, function(stream){
video.src = window.URL.createObjectURL(stream);
video.play();
}, errBack);
}
document.getElementById("snap").addEventListener("click", function() {
context.drawImage(video, 0, 0, 640, 480);
});
}, false);
getUserMedia interface works in Chrome on my Surface 2, prove:
I've implemented solution described here:
http://www.html5rocks.com/en/tutorials/getusermedia/intro/
Btw, there is a working example on their site as well:
getUserMedia doesn't work in IE
getUserMedia probably works in FF, but I didn't test
access to the camera from [Browse] button doesn't work in any browser on my Surface 2
EDIT: Just realized, my approach doesn't work on Surface any more. Same story for the html5rocks page, the example given doesn't work on Surface. I guess, new Chrome version stopped to support something. BUT I've found the example which works on Surface for Chrome and Firefox, here you are:
http://www.ceng.metu.edu.tr/~e1559848/demos/qrdecode/index.html

HTML5 Geolocation doesn't ask for permission and doesn't work on Samsung S3

Using the standard HTML5 geolocation code, I am able to access the geolocation on desktop browsers (Chrome, Firefox), but not on my Samsung Galaxy S3 (default browser, Chrome). In the default browser, nothing at all happens. In Chrome, the yellow permissions form pops up at the bottom but then pops down too quickly to press anything. I have checked that Location is enabled in Settings. I am considering looking for a PHP solution as a backup for cases when JavaScript/HTML5 solution breaks down like this, but would prefer that the JavaScript solution be more robust.
Has anyone come across this and fixed it? Any ideas?
For reference, the "standard" HTML5 geolocation code I'm referring to is this (sample code from: Basic Geolocation in HTML5):
<script type="text/javascript">
if( navigator.geolocation )
{
// Call getCurrentPosition with success and failure callbacks
navigator.geolocation.getCurrentPosition( success, fail );
}
else
{
alert("Sorry, your browser does not support geolocation services.");
}
function success(position)
{
// GeoPosition Object
alert("Your coordinates are " + position.latitude + ", " + position.longitude);
}
function fail()
{
// Could not obtain location
}
</script>
Odd. I did 3 things and now it works in both phone browsers (default and chrome)
I put the main code in a function that is called in <body onload="">
I restarted my phone
I turned off power saving mode
I suspect the restart did the most for it, since I was seeing the permission pop up flash across the screen in chrome.