<script type="text/javascript">
var video = document.getElementById('video');
var url1;
// Get access to the camera!
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
// Not adding `{ audio: true }` since we only want video now
navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
video.src = window.URL.createObjectURL(stream);
if( video.play())
{
Console.log("okokok");
}
else
{
Console.log("nonon");
}
});
}
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var video = document.getElementById('video');
// Trigger photo take
document.getElementById("snap").addEventListener("click", function() {
context.drawImage(video, 0, 0, 640, 480);
});
$(function () {
var alr2=this.url1;
var params = {
// Request parameters
"returnFaceId": "true",
"returnFaceLandmarks": "false",
"returnFaceAttributes": "age",
};
$.ajax({
url: "https://westus.api.cognitive.microsoft.com/face/v1.0/detect?" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","8b99a9ed839a40a08aa8b529ef0f9b8c");
},
type: "POST",
// Request body
data: '{ "url": }'
})
.done(function(data) {
alert("success");
console.log(data[0].faceAttributes.age)
})
.fail(function() {
alert("error");
});
});
here is my code and in this image is drawn by the canvass and i want to make url of that image by canvass and pass it to the json object but how please help me i am stuck in this problem with one month here is the line where pass the url in json object type: "POST", // Request body data: '{ "url": }