Google Canary - en Macbook Air OSX 10.9.4 está dando error
¿Es esto un ERROR en Mac o Canary?
Necesito usar la captura de pantalla a través de Google Canary, que funcionaba antes en versiones anteriores.
Pero desde que lanzaron Canary M37 o M39 ya no funciona. ¿Mi comando --enable-usermedia-screen-capture no es válido en la forma en que lo estoy ejecutando?
$ alias canary="open /Applications/Google\ Chrome\ Canary.app/ --args --enable-usermedia-screen-capturing"
$ canary
Ahora, cuando trato de iniciar la captura de pantalla (que funcionaba en versiones anteriores) me está dando error:
getUserMedia error: NavigatorUserMediaError {constraintName: "", message: "", name: "InvalidStateError"}
código:
function start() {
console.log("Requesting local stream");
btn1.disabled = true;
var video_constraints = {
audio: false,
video: {
mandatory: {
chromeMediaSource: 'screen',
maxWidth: 1024,
maxHeight: 768,
minWidth:800,
minHeight:400,
minFrameRate: 1,
maxFrameRate: 2,
//minAspectRatio: 1.333, maxAspectRatio: 1.334,
}
}
};
navigator.webkitGetUserMedia(video_constraints, function(stream){
console.log("Received local stream");
vid1.src = webkitURL.createObjectURL(stream);
localstream = stream;
}, function(e){
console.log("getUserMedia error: ", e);
});
}
EDITAR:
<html>
<head>
<style>
body {
background: white;
display: -webkit-flex;
-webkit-justify-content: center;
-webkit-align-items: center;
-webkit-flex-direction: column;
}
video {
width: 640px;
height: 480px;
border: 1px solid #e2e2e2;
box-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
</style>
</head>
<body>
<video id="video" autoplay></video>
<p><button id="start">Start</button><button id="cancel">Cancel</button></p>
<script>
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function gotStream(stream) {
console.log("Received local stream");
var video = document.querySelector("video");
video.src = URL.createObjectURL(stream);
localstream = stream;
stream.onended = function() { console.log("Ended"); };
}
function getUserMediaError() {
console.log("getUserMedia() failed.");
}
function onAccessApproved(id) {
if (!id) {
console.log("Access rejected.");
return;
}
navigator.webkitGetUserMedia({
audio:false,
video: { mandatory: { chromeMediaSource: "desktop",
chromeMediaSourceId: id } }
}, gotStream, getUserMediaError);
}
var pending_request_id = null;
document.querySelector('#start').addEventListener('click', function(e) {
pending_request_id = chrome.desktopCapture.chooseDesktopMedia(
["screen", "window"], onAccessApproved);
});
document.querySelector('#cancel').addEventListener('click', function(e) {
if (pending_request_id != null) {
chrome.desktopCapture.cancelChooseDesktopMedia(pending_request_id);
}
});
</script>
</body>
</html>