File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
import RTCView from './RTCView' ;
2
2
3
+ if ( typeof window !== "undefined" ) {
4
+
3
5
window . MediaStream . prototype . release = function release ( ) {
4
6
this . getTracks ( ) . forEach ( ( track ) => track . stop ( ) ) ;
5
7
} ;
@@ -8,6 +10,8 @@ window.MediaStreamTrack.prototype._switchCamera = function _switchCamera() {
8
10
console . warn ( '_switchCamera is not implemented on web.' ) ;
9
11
} ;
10
12
13
+ }
14
+
11
15
const {
12
16
RTCPeerConnection,
13
17
RTCIceCandidate,
@@ -18,13 +22,15 @@ const {
18
22
RTCErrorEvent,
19
23
MediaStream,
20
24
MediaStreamTrack,
21
- } = window ;
25
+ } = typeof window !== "undefined" ? window : { } ;
22
26
23
- const { mediaDevices, permissions } = navigator ;
27
+ const { mediaDevices, permissions } = typeof window !== "undefined" ? navigator : { } ;
24
28
25
29
function registerGlobals ( ) {
26
- window . mediaDevices = navigator . mediaDevices ;
27
- window . permissions = navigator . permissions ;
30
+ if ( typeof window !== "undefined" ) {
31
+ window . mediaDevices = navigator . mediaDevices ;
32
+ window . permissions = navigator . permissions ;
33
+ }
28
34
}
29
35
30
36
export {
You can’t perform that action at this time.
0 commit comments