@lvce-editor/renderer-process 30.28.0 → 30.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rendererProcessMain.js +12 -0
- package/package.json +1 -1
|
@@ -9645,6 +9645,15 @@ const startWebRtcAudioStream = async options => {
|
|
|
9645
9645
|
dc.addEventListener('message', e => {
|
|
9646
9646
|
port.postMessage(e.data);
|
|
9647
9647
|
});
|
|
9648
|
+
port.onmessage = event => {
|
|
9649
|
+
const {
|
|
9650
|
+
data
|
|
9651
|
+
} = event;
|
|
9652
|
+
if (dc.readyState !== 'open') {
|
|
9653
|
+
return;
|
|
9654
|
+
}
|
|
9655
|
+
dc.send(data);
|
|
9656
|
+
};
|
|
9648
9657
|
|
|
9649
9658
|
// 3. Standard WebRTC offer/answer handshake against the Realtime API.
|
|
9650
9659
|
const offer = await pc.createOffer();
|
|
@@ -9652,6 +9661,7 @@ const startWebRtcAudioStream = async options => {
|
|
|
9652
9661
|
pcs[uid] = {
|
|
9653
9662
|
audioCtx,
|
|
9654
9663
|
connection: pc,
|
|
9664
|
+
dataChannel: dc,
|
|
9655
9665
|
micAnalyzer,
|
|
9656
9666
|
micStream,
|
|
9657
9667
|
port,
|
|
@@ -9691,11 +9701,13 @@ const stopWebRtcAudioStream = async options => {
|
|
|
9691
9701
|
const {
|
|
9692
9702
|
audioCtx,
|
|
9693
9703
|
connection,
|
|
9704
|
+
dataChannel,
|
|
9694
9705
|
micStream,
|
|
9695
9706
|
port
|
|
9696
9707
|
} = pc;
|
|
9697
9708
|
delete pcs[uid];
|
|
9698
9709
|
connection.close();
|
|
9710
|
+
dataChannel.close();
|
|
9699
9711
|
for (const t of micStream.getTracks()) {
|
|
9700
9712
|
t.stop();
|
|
9701
9713
|
}
|