我正在尝试使用Affectiva的Web SDK(Javascript)通过Camera Stream来检测情绪。我尝试在JS Fiddle中使用它。它运行正常但是当我从JSFiddle获取代码并在Eclipse中的Java Web Project中使用时,Web Camera提示符没有显示出来。它也无法访问Web Cam。这是代码:
HTML:
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-8" id="affdex_elements" style="width:680px;height:480px;"></div>
<div class="col-md-4">
<div style="height:25em;">
<strong>EMOTION TRACKING RESULTS</strong>
<div id="results" style="word-wrap:break-word;"></div>
</div>
<div>
<strong>DETECTOR LOG MSGS</strong>
</div>
<div id="logs"></div>
</div>
</div>
<div>
<button id="start" onclick="onStart()">Start</button>
<button id="stop" onclick="onStop()">Stop</button>
<button id="reset" onclick="onReset()">Reset</button>
<h3>Affectiva JS SDK CameraDetector to track different emotions.</h3>
<p>
<strong>Instructions</strong>
</br>
Press the start button to start the detector.
<br/> When a face is detected, the probabilities of the different emotions are written to the DOM.
<br/> Press the stop button to end the detector.
</p>
</div>
</div>
</body>
Javascript文件类似于https://jsfiddle.net/affectiva/opyh5e8d/show/
中的内容我复制了代码,但是当我在Eclipse上使用它时,相机无法正常工作。我正在使用Chrome作为浏览器。