Skip to content

Commit c648f2e

Browse files
committed
Better WebRTC detection
Before, any environment with a `window` would be detected as supporting WebRTC.
1 parent 0d9ee4c commit c648f2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var extend = require('xtend')
66
var inherits = require('inherits')
77
var once = require('once')
88
var parallel = require('run-parallel')
9+
var Peer = require('simple-peer')
910
var uniq = require('uniq')
1011
var url = require('url')
1112

@@ -64,7 +65,7 @@ function Client (opts) {
6465

6566
debug('new client %s', self.infoHash)
6667

67-
var webrtcSupport = self._wrtc !== false && (!!self._wrtc || typeof window !== 'undefined')
68+
var webrtcSupport = self._wrtc !== false && (!!self._wrtc || Peer.WEBRTC_SUPPORT)
6869

6970
var announce = (typeof opts.announce === 'string')
7071
? [ opts.announce ]

0 commit comments

Comments
 (0)