Google Canary - auf Macbook Air OSX 10.9.4 wird ein Fehler angezeigt

Ist das ein BUG in Mac oder Canary?

Ich muss die Bildschirmaufnahme über Google Canary verwenden, die zuvor in früheren Versionen funktioniert hat.

Aber seit sie Canary M37 oder M39 veröffentlichen, funktioniert es nicht mehr. Ist mein Befehl --enable-usermedia-screen-capture ungültig, wie ich ihn ausführe?

$ alias canary="open /Applications/Google\ Chrome\ Canary.app/ --args --enable-usermedia-screen-capturing"
$ canary

Now, wenn ich versuche, die Bildschirmaufnahme zu starten (die in alten Versionen funktionierte), gibt es mir einen Fehler, der fehlschlägt:

getUserMedia error:  NavigatorUserMediaError {constraintName: "", message: "", name: "InvalidStateError"}

Code

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);
  });
}  

BEARBEITEN

<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>

Antworten auf die Frage(3)

Ihre Antwort auf die Frage