I'm trying to use the Microsoft Emotion API.
I can use the image version without any issues but when I try to use the video version I get an empty response.
It seems that I can successfully connect with the API because when I give it a wrong file type it returns the proper error code.
Here is my code. Would appreciate any help!
<script type="text/javascript">
//apiKey: Replace this with your own Project Oxford Emotion API key, please do not use my key. I inlcude it here so you can get up and running quickly but you can get your own key for free at https://www.projectoxford.ai/emotion
var apiKey = "mykey";
//apiUrl: The base URL for the API. Find out what this is for other APIs via the API documentation
var apiUrl = "https://api.projectoxford.ai/emotion/v1.0/recognizeinvideo";
$('#btn').click(function () {
CallAPI("https://media.kairos.com/emodemo/videos/demo1.mp4", apiUrl, apiKey);
});
function CallAPI(fileUrl, apiUrl, apiKey)
{
$.ajax({
url: apiUrl,
beforeSend: function (xhrObj) {
xhrObj.setRequestHeader("Content-Type", "application/json");
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key", apiKey);
},
type: "POST",
data: '{"url": "' +fileUrl +'"}'
})
.done(function (response) {
console.log(response);
//ProcessResult(response);
})
.fail(function (error) {
$("#response").text(error.getAllResponseHeaders());
});
}
function ProcessResult(response)
{
var data = JSON.stringify(response);
$("#response").text(data);
}
</script>