Jean-Yves Didier

debugging of video refactoring

......@@ -47,11 +47,11 @@ LiveSource = ARCS.Component.create(
let shadow = document.body;
if (_config.video) {
if (!_config.video) {
video.style.display = "none";
shadow.appendChild(video);
}
if (_config.canvas) {
if (!_config.canvas) {
canvas.style.display = "none";
shadow.appendChild(canvas);
}
......@@ -65,6 +65,7 @@ LiveSource = ARCS.Component.create(
video.onloadedmetadata = e => video.play();
/*video.videoWidth=defaultWidth;
video.videoHeight=defaultHeight;*/
console.log("video started");
self.emit("onReady");
};
......@@ -79,6 +80,7 @@ LiveSource = ARCS.Component.create(
* @emits onReady
*/
this.start = function() {
console.log("call to start");
navigator.mediaDevices.getUserMedia({video: {facingMode: _config.facingMode, width: defaultWidth, height: defaultHeight}})
.then(handleMediaStream)
.catch(errorMediaStream);
......@@ -129,8 +131,8 @@ VideoSource = ARCS.Component.create(
let defaultWidth = _config.width || 320;
let defaultHeight = _config.height || 240;
if (_config.video) video = document.querySelector(_config.video);
if (_config.canvas) canvas = document.querySelector(_config.canvas);
if (!_config.video) video = document.querySelector(_config.video);
if (!_config.canvas) canvas = document.querySelector(_config.canvas);
video = video|| document.createElement("video");
canvas = canvas || document.createElement("canvas");
......
......@@ -3,7 +3,7 @@
"libraries" : [ "../components/video.js","../components/animator.js", "../components/qrcodedetector.js"],
"components" : {
"animator" : { "type": "Animator"},
"video" : { "type": "LiveSource"},
"video" : { "type": "LiveSource", "value" : { "video": "#video", "facingMode": "user"}},
"detector" : { "type": "QRCodeDetector"},
"statemachine" : {
"type": "StateMachine",
......@@ -21,9 +21,7 @@
"controller" : "statemachine",
"sheets": {
"init" : {
"preconnections": [
{ "destination": "video", "slot": "setWidgets", "value": ["video"] }
],
"preconnections": [],
"connections": [
{ "source": "video", "signal": "onReady", "destination": "statemachine", "slot" : "next"}
],
......