Skip to content

Commit

Permalink
feat: webui pseudo audio track
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Jan 26, 2024
1 parent bf67111 commit 73bbb58
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<video-size-select id="whip-video-size"></video-size-select>
</section>
<section>SVC Layer: <select id="whip-layer-select"></select></section>
<section>
<input type="checkbox" id="whip-pseudo-audio"/>Pseudo Audio Track
</section>
<section>
<button onclick="startWhip()">Start</button>
<button id="whip-button-stop">Stop</button>
Expand Down Expand Up @@ -179,6 +182,7 @@ <h3>WHEP Video:</h3>
const idWhipVideoDevice = "whip-video-device"
const idWhipVideoSize = "whip-video-size"
const idWhipButtonStop = "whip-button-stop"
const idWhipPseudoAudio = "whip-pseudo-audio"
const idWhipDataChannel = "whip-datachannel"

initLayerSelect(idWhipLayerSelect, [
Expand Down Expand Up @@ -252,7 +256,11 @@ <h3>WHEP Video:</h3>
sendEncodings: layers.slice(0 - (layers.length - index)),
})

stream.getAudioTracks().map(track => pc.addTrack(track))
if (document.getElementById(idWhipPseudoAudio).checked) {
pc.addTransceiver('audio', { 'direction': 'sendonly' })
} else {
stream.getAudioTracks().map(track => pc.addTrack(track))
}

const audioCodec = getElementValue(idWhipAudioCodec)
document.getElementById(idWhipAudioCodec).disabled = true
Expand Down

0 comments on commit 73bbb58

Please sign in to comment.