Desktop capture monitor and desktop audio on Windows #3574
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is API plumbing for the internal interfaces chromium uses to enumerate desktop capture streams and for getting their thumbnails. It allows for apps to implement their own desktop capture picker window in HTML/Javascript.
Here is a sample app that uses the API:
https://gist.github.com/redgecombe/835fe42b8308a0afaecc
gui.Screen.Init();
gui.Screen.DesktopCaptureMonitor.start(should_include_screens, should_include_monitors); //The screen capture API will monitor the system and trigger the below events.
To stop:
gui.Screen.DesktopCaptureMonitor.stop(); //The screen capture system will stop monitoring the system.
Events:
gui.Screen.DesktopCaptureMonitor.on("added", function (id, name, order, type, primary) {
//id is unique id that can be passed as chromeMediaSourceId
//name is the title of the window or screen
//order is the z-order of the windows, if screens are selected they will appear first
//type of the stream: "screen", "window", "other" or "unknown"
});
gui.Screen.DesktopCaptureMonitor.on("removed", function (id) {
//the id of the screen or monitor that is no longer capturable
});
gui.Screen.DesktopCaptureMonitor.on("orderchanged", function (id, new_order, old_order) {
//id is the screen or window that has changed z-order
//new_order is the new z-order
//old_order is the old z-order
});
gui.Screen.DesktopCaptureMonitor.on("namechanged", function (id, name) {
//id is the screen or window that has changed title
//name is the title
});
gui.Screen.DesktopCaptureMonitor.on("thumbnailchanged", function (id, thumbnail) {
//id is the screen or window that has an updated thumbnail
//thumbnail is the base64 encoded png of the thumbnail
});