* Add a Transceiver to the connection. * @param {String} kind * @param {Object} init
(kind, init)
| 255 | * @param {Object} init |
| 256 | */ |
| 257 | addTransceiver (kind, init) { |
| 258 | if (this.destroying) return |
| 259 | if (this.destroyed) throw errCode(new Error('cannot addTransceiver after peer is destroyed'), 'ERR_DESTROYED') |
| 260 | this._debug('addTransceiver()') |
| 261 | |
| 262 | if (this.initiator) { |
| 263 | try { |
| 264 | this._pc.addTransceiver(kind, init) |
| 265 | this._needsNegotiation() |
| 266 | } catch (err) { |
| 267 | this.destroy(errCode(err, 'ERR_ADD_TRANSCEIVER')) |
| 268 | } |
| 269 | } else { |
| 270 | this.emit('signal', { // request initiator to renegotiate |
| 271 | type: 'transceiverRequest', |
| 272 | transceiverRequest: { kind, init } |
| 273 | }) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Add a MediaStream to the connection. |
no test coverage detected