Browse Source

add helper to extract stream id from the video element

dev1
isymchych 9 years ago
parent
commit
cfa609673b
1 changed files with 20 additions and 1 deletions
  1. 20
    1
      modules/RTC/RTCUIHelper.js

+ 20
- 1
modules/RTC/RTCUIHelper.js View File

@@ -1,5 +1,6 @@
1 1
 /* global $ */
2 2
 var RTCBrowserType = require("./RTCBrowserType");
3
+var RTC = require('./RTC');
3 4
 
4 5
 var RTCUIHelper = {
5 6
 
@@ -66,7 +67,25 @@ var RTCUIHelper = {
66 67
         if (!RTCBrowserType.isIExplorer()) {
67 68
             streamElement.autoplay = true;
68 69
         }
70
+    },
71
+
72
+    /**
73
+     * Extract video stream id from the video element.
74
+     * @param {Element} element
75
+     * @returns {string} video stream id or empty string
76
+     */
77
+    getVideoId: function (element) {
78
+        var src = RTC.getVideoSrc(element);
79
+        if (!src) {
80
+            return "";
81
+        }
82
+
83
+        if (RTCBrowserType.isFirefox()) {
84
+            return src.id;
85
+        }
86
+
87
+        return src;
69 88
     }
70 89
 };
71 90
 
72
-module.exports = RTCUIHelper;
91
+module.exports = RTCUIHelper;

Loading…
Cancel
Save