ソースを参照

fix(tracks) Add metadata to jitsi tracks (#1777)

Add timestamp to all tracks, and display surface to screen sharing tracks
dev1
Robert Pintilii 3年前
コミット
03bc5278da
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更22行の追加0行の削除
  1. 22
    0
      modules/RTC/JitsiLocalTrack.js

+ 22
- 0
modules/RTC/JitsiLocalTrack.js ファイルの表示

@@ -81,6 +81,19 @@ export default class JitsiLocalTrack extends JitsiTrack {
81 81
             this._startStreamEffect(effect);
82 82
         }
83 83
 
84
+        const displaySurface = videoType === VideoType.DESKTOP
85
+            ? track.getSettings().displaySurface
86
+            : null;
87
+
88
+        /**
89
+         * Track metadata.
90
+         */
91
+        this.metadata = {
92
+            timestamp: Date.now(),
93
+            ...displaySurface ? { displaySurface } : {}
94
+        };
95
+
96
+
84 97
         /**
85 98
          * The ID assigned by the RTC module on instance creation.
86 99
          *
@@ -196,6 +209,15 @@ export default class JitsiLocalTrack extends JitsiTrack {
196 209
         this._initNoDataFromSourceHandlers();
197 210
     }
198 211
 
212
+    /**
213
+     * Get the duration of the track.
214
+     *
215
+     * @returns {Number} the duration of the track in seconds
216
+     */
217
+    getDuration() {
218
+        return (Date.now() / 1000) - (this.metadata.timestamp / 1000);
219
+    }
220
+
199 221
     /**
200 222
      * Returns if associated MediaStreamTrack is in the 'ended' state
201 223
      *

読み込み中…
キャンセル
保存