Procházet zdrojové kódy

feat(virtual-background): Desktop share as virtual background wip

master
tudordan7 před 4 roky
rodič
revize
04a464dfee

+ 5
- 5
react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.js Zobrazit soubor

16
 export default class JitsiStreamBackgroundEffect {
16
 export default class JitsiStreamBackgroundEffect {
17
     _model: Object;
17
     _model: Object;
18
     _options: Object;
18
     _options: Object;
19
-    _stream: Object;
19
+    _screenSharing: Object;
20
     _segmentationPixelCount: number;
20
     _segmentationPixelCount: number;
21
     _inputVideoElement: HTMLVideoElement;
21
     _inputVideoElement: HTMLVideoElement;
22
     _onMaskFrameTimer: Function;
22
     _onMaskFrameTimer: Function;
43
      */
43
      */
44
     constructor(model: Object, options: Object, screenSharing: Object) {
44
     constructor(model: Object, options: Object, screenSharing: Object) {
45
         this._options = options;
45
         this._options = options;
46
-        this._stream = screenSharing;
46
+        this._screenSharing = screenSharing;
47
 
47
 
48
         if (this._options.virtualBackground.backgroundType === 'image') {
48
         if (this._options.virtualBackground.backgroundType === 'image') {
49
             this._virtualImage = document.createElement('img');
49
             this._virtualImage = document.createElement('img');
50
             this._virtualImage.crossOrigin = 'anonymous';
50
             this._virtualImage.crossOrigin = 'anonymous';
51
             this._virtualImage.src = this._options.virtualBackground.virtualSource;
51
             this._virtualImage.src = this._options.virtualBackground.virtualSource;
52
         }
52
         }
53
-        if (this._options.virtualBackground.backgroundType === 'desktop-share' && this._stream) {
53
+        if (this._options.virtualBackground.backgroundType === 'desktop-share' && this._screenSharing) {
54
             this._virtualVideo = document.createElement('video');
54
             this._virtualVideo = document.createElement('video');
55
             this._virtualVideo.autoplay = true;
55
             this._virtualVideo.autoplay = true;
56
-            this._virtualVideo.srcObject = this._stream.stream;
56
+            this._virtualVideo.srcObject = this._screenSharing.stream;
57
         }
57
         }
58
         this._model = model;
58
         this._model = model;
59
         this._options = options;
59
         this._options = options;
252
         this._inputVideoElement.height = parseInt(height, 10);
252
         this._inputVideoElement.height = parseInt(height, 10);
253
         this._inputVideoElement.autoplay = true;
253
         this._inputVideoElement.autoplay = true;
254
         this._inputVideoElement.srcObject = stream;
254
         this._inputVideoElement.srcObject = stream;
255
-        this._stream && this._stream.on(
255
+        this._screenSharing && this._screenSharing.on(
256
             JitsiTrackEvents.LOCAL_TRACK_STOPPED,
256
             JitsiTrackEvents.LOCAL_TRACK_STOPPED,
257
             () => {
257
             () => {
258
                 this._options.virtualBackground.enabled = false;
258
                 this._options.virtualBackground.enabled = false;

Načítá se…
Zrušit
Uložit