Answer the question
In order to leave comments, you need to log in
What are the three black dots when capturing the screen?
Salute to all, in short, you need to capture the screen for further processing, so that everything immediately becomes clear, I will give a scenario that well shows what the problem is.
We have markup:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<video id="video" width="1920" height="1080"></video>
<div id="capture">Сapture</div>
<canvas id="canvas" width="1920" height="1080"></canvas>
<script src="js.js"></script>
</body>
</html>
body {
margin: 0;
padding: 0;
background: #f9f9f9;
overflow: hidden;
}
#capture{
position: absolute;
top: 10%;
left: 10%;
background: #fff;
}
{
"name": "Capture",
"main": "index.html",
"version": "0.0.1",
"window": {
"width": 800,
"height": 600,
"resizable": true,
"toolbar": false,
"frame": true,
"transparent": false,
}
}
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var dcm = nw.Screen.DesktopCaptureMonitor;
nw.Screen.Init();
dcm.on("added", function (id, name, order, type){
var constraints = {
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: dcm.registerStream(id)
}
}
};
navigator.webkitGetUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: constraints.video.mandatory.chromeMediaSourceId,
maxWidth: 1920,
maxHeight: 1080
},
optional: []
}
},
function(stream){
tvideo = document.getElementById('video');
tvideo.src = window.URL.createObjectURL(stream);
tvideo.onloadedmetadata = function(e) {
tvideo.play();
}
},
function(err){
console.log(err);
});
dcm.stop();
});
dcm.on("removed", function (id){ });
dcm.on("orderchanged", function (id, new_order, old_order){ });
dcm.on("namechanged", function (id, name){ });
dcm.on("thumbnailchanged", function (id, thumbnail){ });
dcm.start(true, false);
document.getElementById('capture').addEventListener('click', function() {
context.drawImage(tvideo, 0, 0);
});
Answer the question
In order to leave comments, you need to log in
Judging by what I see, these are not "extra three dots", but a screen buffer shifted to the right by 3 pixels.
That is, the picture is shifted to the right, and what "left" out of bounds is drawn one pixel lower to the left.
Accordingly, three points are empty three points.
Try dcm.start(true, true); as in the instructions.
It turns out to be shifted to the right by 3px, down by 1px, I can’t understand the nature of this phenomenon, so I turned to the collective mind.
this construction dcm.start(true, true); not in business here.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question