var screen_constraints = { mandatory: { chromeMediaSource: 'screen', maxWidth: 1920, maxHeight: 1080, minAspectRatio: 1.77 } }; var session = { audio: false, video: screen_constraints }; navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; var constraints = { video: true ,audio:true}; function successCallback(localMediaStream) { window.stream = localMediaStream; // stream available to console var video = document.querySelector("video"); video.src = window.URL.createObjectURL(localMediaStream); video.play(); } function errorCallback(error) { console.log("navigator.getUserMedia error: ", error); } navigator.getUserMedia(session, successCallback, errorCallback);
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- head; this <link> tag MUST be in <head> section --> <script src="Scripts/test.js"></script> </head> <body> <video autoplay style="height:400px;width:400px"></video> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)