diff --git a/HISTORY.md b/HISTORY.md index f141cc10..db767c3f 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -81,6 +81,7 @@ * Blocks, Objects, Threads: integrated video capture control into global settings prims in Sensing * Blocks, Threads: added a %self menu * Blocks, Threads, Objects: Finalized Video ops +* Objects, Threads, GUI: auto-start video capture when querying, stop video on stop-all ### 2019-05-07 * Blocks, Objects, Threads, Video: optimized video motion detection diff --git a/snap.html b/snap.html index 860e7f90..76cd9725 100755 --- a/snap.html +++ b/snap.html @@ -9,7 +9,7 @@ - + diff --git a/src/gui.js b/src/gui.js index 42f811da..bbc96f81 100644 --- a/src/gui.js +++ b/src/gui.js @@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2019-May-07'; +modules.gui = '2019-May-08'; // Declarations diff --git a/src/objects.js b/src/objects.js index 7c122d00..0aaddadc 100644 --- a/src/objects.js +++ b/src/objects.js @@ -7726,8 +7726,10 @@ StageMorph.prototype.fireStopAllEvent = function () { this.keysPressed = {}; this.threads.stopAll(); - this.stopAllActiveSounds(); + if (this.videoElement) { + this.stopVideo(); + } this.children.forEach(function (morph) { if (morph.stopTalking) { morph.stopTalking(); diff --git a/src/threads.js b/src/threads.js index 07119fba..2edc3408 100644 --- a/src/threads.js +++ b/src/threads.js @@ -1907,6 +1907,9 @@ Process.prototype.doStopAll = function () { stage.keysPressed = {}; stage.runStopScripts(); stage.threads.stopAll(); + if (stage.videoElement) { + stage.stopVideo(); + } stage.children.forEach(function (morph) { if (morph.stopTalking) { morph.stopTalking(); @@ -4447,8 +4450,15 @@ Process.prototype.reportVideo = function(attribute, name) { stage = thisObj.parentThatIsA(StageMorph), thatObj = this.getOtherObject(name, thisObj, stage); - if (!stage || !stage.videoElement) { - return null; + if (!stage.videoElement || !stage.videoElement.stream) { + // wait until video is turned on + if (!this.context.accumulator) { + this.context.accumulator = true; // started video + stage.startVideo(); + } + this.pushContext('doYield'); + this.pushContext(); + return; } switch (this.inputOption(attribute)) {