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 11import RTCView from './RTCView' ;
22
3+ if ( typeof window !== "undefined" ) {
4+
35window . MediaStream . prototype . release = function release ( ) {
46 this . getTracks ( ) . forEach ( ( track ) => track . stop ( ) ) ;
57} ;
@@ -8,6 +10,8 @@ window.MediaStreamTrack.prototype._switchCamera = function _switchCamera() {
810 console . warn ( '_switchCamera is not implemented on web.' ) ;
911} ;
1012
13+ }
14+
1115const {
1216 RTCPeerConnection,
1317 RTCIceCandidate,
@@ -18,13 +22,15 @@ const {
1822 RTCErrorEvent,
1923 MediaStream,
2024 MediaStreamTrack,
21- } = window ;
25+ } = typeof window !== "undefined" ? window : { } ;
2226
23- const { mediaDevices, permissions } = navigator ;
27+ const { mediaDevices, permissions } = typeof window !== "undefined" ? navigator : { } ;
2428
2529function 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+ }
2834}
2935
3036export {
You can’t perform that action at this time.
0 commit comments