Skip to content

Commit

Permalink
fix(webrtc): on call track logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwoodland authored and stavares843 committed Jun 22, 2022
1 parent 980abf2 commit e2be1ae
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions store/webrtc/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,23 +507,14 @@ const webRTCActions = {
kind?: string | undefined
}) {
$Logger.log('webrtc', `local track created: ${track.kind}#${track.id}`)
let muted = false
if (kind === 'audio') {
muted = rootState.audio.muted
} else if (kind === 'video') {
muted = rootState.video.disabled
if (!kind) {
return
}
commit('setMuted', {
peerId: $Peer2Peer.id,
kind,
muted:
kind === 'audio' ? rootState.audio.muted : rootState.video.disabled,
muted: false,
})
if (kind === 'audio' && rootState.audio.muted) {
call.mute({ peerId: localId, kind: 'audio' })
} else if (kind === 'video' && rootState.video.disabled) {
call.mute({ peerId: localId, kind: 'video' })
}
}
call.on('LOCAL_TRACK_CREATED', onCallTrack)

Expand All @@ -545,9 +536,6 @@ const webRTCActions = {
kind,
muted: false,
})
if (rootState.audio.muted) {
call.mute({ peerId: localId, kind: 'audio' })
}
}
call.on('REMOTE_TRACK_RECEIVED', onCallPeerTrack)

Expand Down

0 comments on commit e2be1ae

Please sign in to comment.