File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ const props = defineProps({
2121const hasStream = ref (false );
2222const pc = new RTCPeerConnection ();
2323const stream = ref (null );
24+ const srcObject = ref (new MediaStream ())
2425const grantPermissions = async (evt , constraints = {audio: true , video: false }) => {
2526 try {
2627 console .log (constraints)
@@ -85,10 +86,13 @@ pc.ondatachannel = (e) => {
8586}
8687pc .ontrack = (e ) => {
8788 console .log (' New track' , e)
88- let inboundStream = new MediaStream ([e .track ]);
89- const audio = new Audio ()
90- audio .srcObject = inboundStream;
89+ ;
90+ srcObject .value .addTrack (e .track );
91+ console .log (srcObject)
92+ const audio = document .getElementById (' audio' );
93+ audio .srcObject = srcObject .value
9194 audio .play ()
95+ console .log (audio .srcObject )
9296}
9397onMounted (() => {
9498
@@ -110,7 +114,6 @@ onMounted(() => {
110114 console .log (pc)
111115 }
112116 });
113- console .log (Echo)
114117})
115118
116119 </script >
@@ -213,6 +216,7 @@ onMounted(() => {
213216 >
214217 Grant Permissions
215218 </PrimaryButton >
219+ <audio id =" audio" controls ></audio >
216220 </p >
217221
218222
You can’t perform that action at this time.
0 commit comments