make sure video capture is turned on before accessing it programmatically

pull/95/head
jmoenig 2020-11-22 11:32:42 +01:00
rodzic a37dfa340f
commit b647bdf820
3 zmienionych plików z 14 dodań i 14 usunięć

Wyświetl plik

@ -15,6 +15,7 @@
### 2020-11-22
* objects: fixed display of inherited sprite-local variables
* threads: make sure video capture is turned on before accessing it programmatically
### 2020-11-21
* new dev version

Wyświetl plik

@ -9,7 +9,7 @@
<script src="src/symbols.js?version=2020-10-07"></script>
<script src="src/widgets.js?version=2020-10-06"></script>
<script src="src/blocks.js?version=2020-11-21"></script>
<script src="src/threads.js?version=2020-11-21"></script>
<script src="src/threads.js?version=2020-11-22"></script>
<script src="src/objects.js?version=2020-11-22"></script>
<script src="src/gui.js?version=2020-11-21"></script>
<script src="src/paint.js?version=2020-05-17"></script>

Wyświetl plik

@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
modules.threads = '2020-November-21';
modules.threads = '2020-November-22';
var ThreadManager;
var Process;
@ -5273,6 +5273,17 @@ Process.prototype.doSetVideoTransparency = function(factor) {
Process.prototype.reportVideo = function(attribute, name) {
// hyper-dyadic
var stage = this.blockReceiver().parentThatIsA(StageMorph);
if (!stage.projectionSource || !stage.projectionSource.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;
}
return this.hyperDyadic(
(att, obj) => this.reportBasicVideo(att, obj),
attribute,
@ -5284,18 +5295,6 @@ Process.prototype.reportBasicVideo = function(attribute, name) {
var thisObj = this.blockReceiver(),
stage = thisObj.parentThatIsA(StageMorph),
thatObj = this.getOtherObject(name, thisObj, stage);
if (!stage.projectionSource || !stage.projectionSource.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)) {
case 'motion':
if (thatObj instanceof SpriteMorph) {