|
@@ -1477,8 +1477,9 @@ TraceablePeerConnection.prototype.addTrack = function(track, isInitiator = false
|
1477
|
1477
|
* Adds local track as part of the unmute operation.
|
1478
|
1478
|
* @param {JitsiLocalTrack} track the track to be added as part of the unmute
|
1479
|
1479
|
* operation
|
1480
|
|
- * @return {boolean} <tt>true</tt> if the state of underlying PC has changed and
|
1481
|
|
- * the renegotiation is required or <tt>false</tt> otherwise.
|
|
1480
|
+ * @return {Promise<boolean>} Promise that resolves to true if the underlying PeerConnection's
|
|
1481
|
+ * state has changed and renegotiation is required, false if no renegotiation is needed or
|
|
1482
|
+ * Promise is rejected when something goes wrong.
|
1482
|
1483
|
*/
|
1483
|
1484
|
TraceablePeerConnection.prototype.addTrackUnmute = function(track) {
|
1484
|
1485
|
if (browser.usesUnifiedPlan()) {
|
|
@@ -1486,7 +1487,7 @@ TraceablePeerConnection.prototype.addTrackUnmute = function(track) {
|
1486
|
1487
|
}
|
1487
|
1488
|
if (!this._assertTrackBelongs('addTrackUnmute', track)) {
|
1488
|
1489
|
// Abort
|
1489
|
|
- return false;
|
|
1490
|
+ return Promise.reject('Track not found on the peerconnection');
|
1490
|
1491
|
}
|
1491
|
1492
|
|
1492
|
1493
|
logger.info(`Adding ${track} as unmute to ${this}`);
|
|
@@ -1496,11 +1497,11 @@ TraceablePeerConnection.prototype.addTrackUnmute = function(track) {
|
1496
|
1497
|
logger.error(
|
1497
|
1498
|
`Unable to add ${track} as unmute to ${this} - no WebRTC stream`);
|
1498
|
1499
|
|
1499
|
|
- return false;
|
|
1500
|
+ return Promise.reject('Stream not found');
|
1500
|
1501
|
}
|
1501
|
1502
|
this._addStream(webRtcStream);
|
1502
|
1503
|
|
1503
|
|
- return true;
|
|
1504
|
+ return Promise.resolve(true);
|
1504
|
1505
|
};
|
1505
|
1506
|
|
1506
|
1507
|
/**
|
|
@@ -1676,8 +1677,9 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
|
1676
|
1677
|
* Removes local track as part of the mute operation.
|
1677
|
1678
|
* @param {JitsiLocalTrack} localTrack the local track to be remove as part of
|
1678
|
1679
|
* the mute operation.
|
1679
|
|
- * @return {boolean} <tt>true</tt> if the underlying PeerConnection's state has
|
1680
|
|
- * changed and the renegotiation is required or <tt>false</tt> otherwise.
|
|
1680
|
+ * @return {Promise<boolean>} Promise that resolves to true if the underlying PeerConnection's
|
|
1681
|
+ * state has changed and renegotiation is required, false if no renegotiation is needed or
|
|
1682
|
+ * Promise is rejected when something goes wrong.
|
1681
|
1683
|
*/
|
1682
|
1684
|
TraceablePeerConnection.prototype.removeTrackMute = function(localTrack) {
|
1683
|
1685
|
if (browser.usesUnifiedPlan()) {
|
|
@@ -1691,19 +1693,19 @@ TraceablePeerConnection.prototype.removeTrackMute = function(localTrack) {
|
1691
|
1693
|
|
1692
|
1694
|
if (!this._assertTrackBelongs('removeStreamMute', localTrack)) {
|
1693
|
1695
|
// Abort - nothing to be done here
|
1694
|
|
- return false;
|
|
1696
|
+ return Promise.reject('Track not found in the peerconnection');
|
1695
|
1697
|
}
|
1696
|
1698
|
if (webRtcStream) {
|
1697
|
1699
|
logger.info(
|
1698
|
1700
|
`Removing ${localTrack} as mute from ${this}`);
|
1699
|
1701
|
this._removeStream(webRtcStream);
|
1700
|
1702
|
|
1701
|
|
- return true;
|
|
1703
|
+ return Promise.resolve(true);
|
1702
|
1704
|
}
|
1703
|
1705
|
|
1704
|
1706
|
logger.error(`removeStreamMute - no WebRTC stream for ${localTrack}`);
|
1705
|
1707
|
|
1706
|
|
- return false;
|
|
1708
|
+ return Promise.reject('Stream not found');
|
1707
|
1709
|
};
|
1708
|
1710
|
|
1709
|
1711
|
/**
|