|
|
@@ -1,6 +1,24 @@
|
|
1
|
1
|
/* global APP */
|
|
2
|
2
|
var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
|
|
3
|
3
|
var RTCEvents = require("../../service/RTC/RTCEvents");
|
|
|
4
|
+var RTCBrowserType = require("./RTCBrowserType");
|
|
|
5
|
+
|
|
|
6
|
+/**
|
|
|
7
|
+ * This implements 'onended' callback normally fired by WebRTC after the stream
|
|
|
8
|
+ * is stopped. There is no such behaviour yet in FF, so we have to add it.
|
|
|
9
|
+ * @param stream original WebRTC stream object to which 'onended' handling
|
|
|
10
|
+ * will be added.
|
|
|
11
|
+ */
|
|
|
12
|
+function implementOnEndedHandling(stream) {
|
|
|
13
|
+ var originalStop = stream.stop;
|
|
|
14
|
+ stream.stop = function () {
|
|
|
15
|
+ originalStop.apply(stream);
|
|
|
16
|
+ if (!stream.ended) {
|
|
|
17
|
+ stream.ended = true;
|
|
|
18
|
+ stream.onended();
|
|
|
19
|
+ }
|
|
|
20
|
+ };
|
|
|
21
|
+}
|
|
4
|
22
|
|
|
5
|
23
|
function LocalStream(stream, type, eventEmitter, videoType, isGUMStream) {
|
|
6
|
24
|
this.stream = stream;
|
|
|
@@ -21,9 +39,12 @@ function LocalStream(stream, type, eventEmitter, videoType, isGUMStream) {
|
|
21
|
39
|
};
|
|
22
|
40
|
}
|
|
23
|
41
|
|
|
24
|
|
- this.stream.onended = function() {
|
|
|
42
|
+ this.stream.onended = function () {
|
|
25
|
43
|
self.streamEnded();
|
|
26
|
44
|
};
|
|
|
45
|
+ if (RTCBrowserType.isFirefox()) {
|
|
|
46
|
+ implementOnEndedHandling(this.stream);
|
|
|
47
|
+ }
|
|
27
|
48
|
}
|
|
28
|
49
|
|
|
29
|
50
|
LocalStream.prototype.streamEnded = function () {
|