Skip to content

Commit 13f5359

Browse files
authored
fix RtpSender replaceTrack with null
1 parent bd2a738 commit 13f5359

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/iosrtcPlugin.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,13 +1465,14 @@ class iosrtcPlugin : CDVPlugin {
14651465
return
14661466
}
14671467

1468-
if let trackId = trackId, let pluginMediaStreamTrack = self.pluginMediaStreamTracks[trackId] {
1468+
let pluginMediaStreamTrack = trackId != nil ? self.pluginMediaStreamTracks[trackId!] : nil;
1469+
if trackId == nil || pluginMediaStreamTrack != nil {
14691470
pluginRTCRptSender.replaceTrack(pluginMediaStreamTrack)
14701471
self.emit(command.callbackId,
14711472
result: CDVPluginResult(
14721473
status: CDVCommandStatus_OK,
14731474
messageAs: [
1474-
"track": pluginMediaStreamTrack.getJSON()
1475+
"track": pluginMediaStreamTrack?.getJSON()
14751476
]))
14761477
} else {
14771478
NSLog("iosrtcPlugin#RTCPeerConnection_RTCRtpSender_replaceTrack() | ERROR: Unable to find track")

0 commit comments

Comments
 (0)