Added test for releasing camera, fixed code-style

This commit is contained in:
Christoph Oberhofer
2014-12-17 21:57:28 +01:00
parent 655bc6453a
commit 206a624edb
6 changed files with 98 additions and 10 deletions
+5 -4
View File
@@ -93,10 +93,11 @@ define(function() {
request(video, callback);
},
release : function() {
var tracks = streamRef && streamRef.getVideoTracks();
if (tracks.length)
tracks[0].stop();
streamRef = null;
var tracks = streamRef && streamRef.getVideoTracks();
if (tracks.length) {
tracks[0].stop();
}
streamRef = null;
}
};
});
+2 -2
View File
@@ -191,8 +191,8 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
},
stop : function() {
_stopped = true;
if (_config.inputStream.type == "LiveStream") {
CameraAccess.release();
if (_config.inputStream.type === "LiveStream") {
CameraAccess.release();
}
},
onDetected : function(callback) {