auto-start video capture when querying, stop video on stop-all

pull/89/head
jmoenig 2019-05-08 15:25:29 +02:00
rodzic 20e2d70723
commit 358296bb11
5 zmienionych plików z 18 dodań i 5 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -9,7 +9,7 @@
<script type="text/javascript" src="src/blocks.js?version=2019-05-08"></script>
<script type="text/javascript" src="src/threads.js?version=2019-05-08"></script>
<script type="text/javascript" src="src/objects.js?version=2019-05-08"></script>
<script type="text/javascript" src="src/gui.js?version=2019-05-07"></script>
<script type="text/javascript" src="src/gui.js?version=2019-05-08"></script>
<script type="text/javascript" src="src/paint.js?version=2019-02-22"></script>
<script type="text/javascript" src="src/lists.js?version=2019-04-27"></script>
<script type="text/javascript" src="src/byob.js?version=2019-02-15"></script>

Wyświetl plik

@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2019-May-07';
modules.gui = '2019-May-08';
// Declarations

Wyświetl plik

@ -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();

Wyświetl plik

@ -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)) {