File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,19 @@ const props = defineProps({
1111 }
1212})
1313
14-
14+ const pc = new RTCPeerConnection ();
15+ let stream = null ;
16+ const grantPermissions = async (constraints = {audio: true }) => {
17+ try {
18+ stream = await navigator .mediaDevices .getUserMedia (constraints);
19+ for (const track of stream .getTracks ()) {
20+ pc .addTrack (track, stream);
21+ }
22+ /* use the stream */
23+ } catch (err) {
24+ /* handle the error */
25+ }
26+ }
1527const form = useForm ({
1628 caller_id: ' ' ,
1729 sdp: {}
@@ -57,7 +69,6 @@ const answer = async (caller_id) => {
5769 },
5870 });
5971};
60- const pc = new RTCPeerConnection ();
6172pc .ondatachannel = (e ) => {
6273 console .log (' New data channel' , e)
6374}
@@ -179,6 +190,13 @@ onMounted(() => {
179190 Call
180191 </PrimaryButton >
181192 </form >
193+
194+ <PrimaryButton
195+ class =" ms-4"
196+ @click =" grantPermissions"
197+ >
198+ Grant Permissions
199+ </PrimaryButton >
182200 </p >
183201
184202
You can’t perform that action at this time.
0 commit comments