getscreenmedia
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -1,3 +0,2 @@ | ||
// getScreenMedia helper by @HenrikJoreteg | ||
var getUserMedia = require('getusermedia'); | ||
var adapter = require('webrtc-adapter'); | ||
@@ -47,3 +46,7 @@ // cache for constraints and callback | ||
constraints.video.mandatory.chromeMediaSourceId = data.sourceId; | ||
getUserMedia(constraints, callback); | ||
window.navigator.mediaDevices.getUserMedia(constraints).then(function (stream) { | ||
callback(null, stream); | ||
}).catch(function (err) { | ||
callback(err); | ||
}); | ||
} | ||
@@ -73,3 +76,7 @@ } | ||
constraints.video.mandatory.chromeMediaSourceId = sourceId; | ||
getUserMedia(constraints, callback); | ||
window.navigator.mediaDevices.getUserMedia(constraints).then(function (stream) { | ||
callback(null, stream); | ||
}).catch(function (err) { | ||
callback(err); | ||
}); | ||
} | ||
@@ -91,3 +98,7 @@ }); | ||
}; | ||
getUserMedia(constraints, callback); | ||
window.navigator.mediaDevices.getUserMedia(constraints).then(function (stream) { | ||
callback(null, stream); | ||
}).catch(function (err) { | ||
callback(err); | ||
}); | ||
} else { | ||
@@ -112,18 +123,17 @@ // chrome 34+ way requiring an extension | ||
}; | ||
getUserMedia(constraints, function (err, stream) { | ||
callback(err, stream); | ||
// workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1045810 | ||
if (!err) { | ||
var lastTime = stream.currentTime; | ||
var polly = window.setInterval(function () { | ||
if (!stream) window.clearInterval(polly); | ||
if (stream.currentTime == lastTime) { | ||
window.clearInterval(polly); | ||
if (stream.onended) { | ||
stream.onended(); | ||
} | ||
window.navigator.mediaDevices.getUserMedia(constraints).then(function (stream) { | ||
callback(null, stream); | ||
var lastTime = stream.currentTime; | ||
var polly = window.setInterval(function () { | ||
if (!stream) window.clearInterval(polly); | ||
if (stream.currentTime == lastTime) { | ||
window.clearInterval(polly); | ||
if (stream.onended) { | ||
stream.onended(); | ||
} | ||
lastTime = stream.currentTime; | ||
}, 500); | ||
} | ||
} | ||
lastTime = stream.currentTime; | ||
}, 500); | ||
}).catch(function (err) { | ||
callback(err); | ||
}); | ||
@@ -165,3 +175,7 @@ } else { | ||
constraints.video.mandatory.chromeMediaSourceId = event.data.sourceId; | ||
getUserMedia(constraints, callback); | ||
window.navigator.mediaDevices.getUserMedia(constraints).then(function (stream) { | ||
callback(null, stream); | ||
}).catch(function (err) { | ||
callback(err); | ||
}); | ||
} | ||
@@ -168,0 +182,0 @@ } else if (event.data.type == 'getScreenPending') { |
{ | ||
"name": "getscreenmedia", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "A browser module for attempting to get access to a MediaStream of a user's screen. With a nice node-like API.", | ||
@@ -19,4 +19,4 @@ "main": "getscreenmedia.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"getusermedia": "^2.0.0" | ||
"peerDependencies": { | ||
"webrtc-adapter": "^3.1.6" | ||
}, | ||
@@ -23,0 +23,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127922
3124
1
+ Addedwebrtc-adapter@3.4.3(transitive)
- Removedgetusermedia@^2.0.0
- Removedgetusermedia@2.0.1(transitive)
- Removedwebrtc-adapter@2.1.0(transitive)