|
@@ -2013,9 +2013,14 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
|
2013
|
2013
|
.then(() => {
|
2014
|
2014
|
oldTrack && this.localTracks.delete(oldTrack.rtcId);
|
2015
|
2015
|
newTrack && this.localTracks.set(newTrack.rtcId, newTrack);
|
2016
|
|
-
|
2017
|
|
- if (transceiver) {
|
2018
|
|
- // Set the transceiver direction.
|
|
2016
|
+ const mediaActive = mediaType === MediaType.AUDIO
|
|
2017
|
+ ? this.audioTransferActive
|
|
2018
|
+ : this.videoTransferActive;
|
|
2019
|
+
|
|
2020
|
+ // Set the transceiver direction only if media is not suspended on the connection. This happens when
|
|
2021
|
+ // the client is using the p2p connection. Transceiver direction is updated when media is resumed on
|
|
2022
|
+ // this connection again.
|
|
2023
|
+ if (transceiver && mediaActive) {
|
2019
|
2024
|
transceiver.direction = newTrack ? MediaDirection.SENDRECV : MediaDirection.RECVONLY;
|
2020
|
2025
|
}
|
2021
|
2026
|
|