Fast prototype code to hook up a webcam to the Azure Emotion API
Dealing with DOM

document.getElement[s]By*(...) competes with $(...). Do not mix DOM accessing styles. That hurts readability. Either use jQuery everywhere, or native API everywhere. jQuery is kind of out of fashion nowadays, mainly because major browsers got much better in exposing DOM accessing APIs.

Dealing with Http

Again, since your code already depends on jQuery, I don't see why prefer XMLHttpRequest over $.ajax(). Inconsistency of the code is one of the biggest issues when it comes to maintenance, especially in case of new hires.

Separate Data from Logic

Your mood to color scheme relationship is data that can be encapsulated in a separate place (apart from the places where it's being used). Say, you define color scheme like this: 

  var schemeOfMood = {
      'Angry': { htmlBackground: '#F44336', htmlColor: '#FFFFFF', spanBackground: '#FFFFFF' },
      'Contempt': { htmlBackground: '#9C27B0', htmlColor: '#FFFFFF', spanBackground: '#FFFFFF' },
      // ...
  };


then the coloration logic becomes trivial, and no ugly switch is needed at all.

  var scheme = schemeOfMood[tempEmotion];
  htmlBody.css('background-color', scheme.htmlBackground);
  htmlBody.css('color', scheme.htmlColor);
  $('span').css('background-color', scheme.spanBackground);


The other good effect is the reduced code repetition.

Move Magic Code into Functions

When I see lines like that they look Magic to me.

let file = document.getElementById('base64image').src.substring(23).replace(' ', '+')


What is subsctring(23)? Why 23 and not 32 (I like powers of 2 more) -- "magic numbers"? Why replace ' ' with '+'? 

If you extract this one-liner into a function, you can give it a good name, thus expressing your intent. At the moment, I didn't even try to understand why that manual transformation of a base64 image is needed.

Unclear Intent

When giving user a feedback, there's this if (result[0]) { ... } that makes the code look only into the first result. Why is that?

Put it into a variable, give it a name, and you will avoid the hard-to-read result[0] and explain what's going on.

var lastChronologicalResult = result[0];
if (lastChronologicalResult) {
  // work against lastChronologicalResult
}




Very similarly, the code loops through multiple results' child nodes (for (let i = 0; i &lt; result[0].childNodes.length; i++) { ... }) and does two things:

A) populates emotionArray based on each child;

B) calculates the tempEmotion based on the last child which has .textContent.toFixed(2) &gt; tempValue. Nobody knows what textContain holds and what's the tempValue.

So, better naming things and function extraction would clarify what is being done in that part of the code.