@live-change/peer-connection-frontend 0.8.93 → 0.8.95

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.
@@ -14,6 +14,7 @@ declare module 'vue' {
14
14
  Dialog: typeof import('primevue/dialog')['default']
15
15
  Dropdown: typeof import('primevue/dropdown')['default']
16
16
  InputSwitch: typeof import('primevue/inputswitch')['default']
17
+ MediaSettingsButton: typeof import('./src/components/MediaSettingsButton.vue')['default']
17
18
  MicrophoneButton: typeof import('./src/components/MicrophoneButton.vue')['default']
18
19
  PermissionsDialog: typeof import('./src/components/PermissionsDialog.vue')['default']
19
20
  RouterLink: typeof import('vue-router')['RouterLink']
@@ -44,6 +44,11 @@
44
44
  </div>
45
45
  </div>
46
46
 
47
+ <div v-if="gettingUserMedia"
48
+ class="absolute top-0 left-0 w-full h-full flex flex-column justify-content-center align-items-center">
49
+ <ProgressSpinner />
50
+ </div>
51
+
47
52
  <div class="absolute top-0 left-0 w-full h-full flex flex-column justify-content-end align-items-center">
48
53
  <div class="flex flex-row justify-content-between align-items-center h-5rem w-7rem media-buttons">
49
54
  <MicrophoneButton v-model="model" @disabled-audio-click="handleDisabledAudioClick" />
@@ -140,6 +145,8 @@
140
145
  </template>
141
146
  </PermissionsDialog>
142
147
 
148
+ <pre>{{ model }}</pre>
149
+ <!-- <pre>{{ audioInputs }}</pre>-->
143
150
  <!--
144
151
 
145
152
  <pre>PD: {{ permissionsDialog }}</pre>
@@ -163,6 +170,7 @@
163
170
 
164
171
  import Button from 'primevue/button'
165
172
  import Dropdown from 'primevue/dropdown'
173
+ import ProgressSpinner from 'primevue/progressspinner'
166
174
  import PermissionsDialog from './PermissionsDialog.vue'
167
175
  import VolumeIndicator from './VolumeIndicator.vue'
168
176
 
@@ -243,9 +251,22 @@
243
251
  onMounted(updateDevices)
244
252
  }
245
253
 
246
- const audioInputs = computed(() => devices.value.filter(device => device.kind === 'audioinput'))
247
- const audioOutputs = computed(() => devices.value.filter(device => device.kind === 'audiooutput'))
248
- const videoInputs = computed(() => devices.value.filter(device => device.kind === 'videoinput'))
254
+ function fixLabel(device, index) {
255
+ const { deviceId, groupId, kind, label } = device
256
+ if(!label.trim()) return {
257
+ deviceId, groupId, kind,
258
+ label: ({
259
+ audioinput: "Audio Input",
260
+ audiooutput: "Audio Output",
261
+ videoinput: "Video Input"
262
+ }[kind]) + ` ${index + 1}`
263
+ }
264
+ return device
265
+ }
266
+
267
+ const audioInputs = computed(() => devices.value.filter(device => device.kind === 'audioinput').map(fixLabel))
268
+ const audioOutputs = computed(() => devices.value.filter(device => device.kind === 'audiooutput').map(fixLabel))
269
+ const videoInputs = computed(() => devices.value.filter(device => device.kind === 'videoinput').map(fixLabel))
249
270
 
250
271
  watch(audioInputs, (value) => {
251
272
  if(value.length === 0) return
@@ -298,6 +319,13 @@
298
319
  ...model.value,
299
320
  media
300
321
  }
322
+ setTimeout(() => { /// firefox needs this timeout
323
+ model.value = {
324
+ ...model.value,
325
+ media
326
+ }
327
+ console.log("MEDIA STREAM CHANGED", model.value.media, media)
328
+ }, 1)
301
329
  }
302
330
 
303
331
  /* onMounted(() => {
@@ -332,11 +360,18 @@
332
360
  }
333
361
  }, { immediate: true })
334
362
 
335
- let gettingUserMedia = false
363
+ const gettingUserMedia = ref(false)
336
364
  async function updateUserMedia(retry = false) {
337
365
  console.log("USER MEDIA UPDATE WHEN MODEL IS", model.value)
338
- if(gettingUserMedia) return
339
- gettingUserMedia = true
366
+ if(gettingUserMedia.value) return
367
+ if(!retry && model.value.mediaError) {
368
+ console.log("CLEAR MEDIA ERROR")
369
+ model.value = {
370
+ ...model.value,
371
+ mediaError: null
372
+ }
373
+ }
374
+ gettingUserMedia.value = true
340
375
  try {
341
376
  const constraints = selectedConstraints.value
342
377
  const videoAllowed = videoInputRequest.value !== 'none' && constraints.video
@@ -349,6 +384,10 @@
349
384
  try {
350
385
  console.log("GET USER MEDIA")
351
386
  const mediaStream = await getUserMediaNative(constraints)
387
+ if(JSON.stringify(selectedConstraints.value) !== JSON.stringify(constraints)) {
388
+ console.log("SELECTED CONSTRAINTS CHANGED WHILE GETTING USER MEDIA")
389
+ return
390
+ }
352
391
  /* if(userMedia.value && retry) {
353
392
  console.log("CLOSE USER MEDIA")
354
393
  userMedia.value.getTracks().forEach(track => track.stop())
@@ -408,7 +447,7 @@
408
447
  }
409
448
  }
410
449
  } finally {
411
- gettingUserMedia = false
450
+ gettingUserMedia.value = false
412
451
  }
413
452
  }
414
453
 
@@ -459,6 +498,15 @@
459
498
  const permissionsCallbacks = ref({})
460
499
 
461
500
  async function showPermissionsDialog() {
501
+ try {
502
+ await Promise.all([
503
+ navigator.permissions.query({ name: 'camera' }),
504
+ navigator.permissions.query({ name: 'microphone' })
505
+ ])
506
+ } catch(error) {
507
+ /// TODO: some other dialog for firefox...
508
+ return
509
+ }
462
510
  return new Promise((resolve, reject) => {
463
511
  permissionsCallbacks.value = {
464
512
  audioOnly: () => {
@@ -498,6 +546,7 @@
498
546
 
499
547
  function handleEmptyPreviewClick() {
500
548
  if(model.value.media) return
549
+ if(!permissionsDialog.value?.permissions) return
501
550
  const { camera, microphone } = permissionsDialog.value.permissions
502
551
  if(camera === 'denied' || microphone === 'denied') {
503
552
  // open permissions dialog
@@ -507,6 +556,7 @@
507
556
 
508
557
  function handleDisabledAudioClick() {
509
558
  limitedMedia.value = null
559
+ if(!permissionsDialog.value?.permissions) return
510
560
  const { camera, microphone } = permissionsDialog.value.permissions
511
561
  if(camera === 'denied' || microphone === 'denied') {
512
562
  // open permissions dialog
@@ -516,6 +566,7 @@
516
566
  function handleDisabledVideoClick() {
517
567
  console.log("DISABLED VIDEO CLICK")
518
568
  limitedMedia.value = null
569
+ if(!permissionsDialog.value?.permissions) return
519
570
  const { camera, microphone } = permissionsDialog.value.permissions
520
571
  if(camera === 'denied' || microphone === 'denied') {
521
572
  // open permissions dialog
@@ -545,7 +596,7 @@
545
596
  function updateAudioInput(value) {
546
597
  model.value = {
547
598
  ...model.value,
548
- audioInput: value
599
+ audioInput: value,
549
600
  }
550
601
  }
551
602
  function updateAudioOutput(value) {
@@ -105,8 +105,13 @@
105
105
 
106
106
  for(const requiredPermission of JSON.parse(value)) {
107
107
  console.log("check permission", requiredPermission)
108
- const permissionState = await navigator.permissions.query(requiredPermission)
109
- const state = permissionState ? permissionState.state : "unknown"
108
+ let state, permissionState
109
+ try {
110
+ permissionState = await navigator.permissions.query(requiredPermission)
111
+ state = permissionState ? permissionState.state : "unknown"
112
+ } catch {
113
+ state = 'not_supported'
114
+ }
110
115
  model.value = {
111
116
  ...model.value,
112
117
  permissions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/peer-connection-frontend",
3
- "version": "0.8.93",
3
+ "version": "0.8.95",
4
4
  "scripts": {
5
5
  "memDev": "dotenvx run -- node server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; dotenvx run -- node server/start.js localDev --enableSessions --initScript ./init.js",
@@ -22,19 +22,19 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/cli": "^0.8.93",
26
- "@live-change/dao": "^0.8.93",
27
- "@live-change/dao-vue3": "^0.8.93",
28
- "@live-change/dao-websocket": "^0.8.93",
29
- "@live-change/framework": "^0.8.93",
30
- "@live-change/password-authentication-service": "^0.8.93",
31
- "@live-change/secret-code-service": "^0.8.93",
32
- "@live-change/secret-link-service": "^0.8.93",
33
- "@live-change/session-service": "^0.8.93",
34
- "@live-change/user-frontend": "^0.8.93",
35
- "@live-change/user-service": "^0.8.93",
36
- "@live-change/vue3-components": "^0.8.93",
37
- "@live-change/vue3-ssr": "^0.8.93",
25
+ "@live-change/cli": "^0.8.95",
26
+ "@live-change/dao": "^0.8.95",
27
+ "@live-change/dao-vue3": "^0.8.95",
28
+ "@live-change/dao-websocket": "^0.8.95",
29
+ "@live-change/framework": "^0.8.95",
30
+ "@live-change/password-authentication-service": "^0.8.95",
31
+ "@live-change/secret-code-service": "^0.8.95",
32
+ "@live-change/secret-link-service": "^0.8.95",
33
+ "@live-change/session-service": "^0.8.95",
34
+ "@live-change/user-frontend": "^0.8.95",
35
+ "@live-change/user-service": "^0.8.95",
36
+ "@live-change/vue3-components": "^0.8.95",
37
+ "@live-change/vue3-ssr": "^0.8.95",
38
38
  "@vueuse/core": "^10.11.0",
39
39
  "boxicons": "^2.1.4",
40
40
  "codeceptjs-assert": "^0.0.5",
@@ -54,7 +54,7 @@
54
54
  "vue3-scroll-border": "0.1.6"
55
55
  },
56
56
  "devDependencies": {
57
- "@live-change/codeceptjs-helper": "^0.8.93",
57
+ "@live-change/codeceptjs-helper": "^0.8.95",
58
58
  "codeceptjs": "^3.6.5",
59
59
  "generate-password": "1.7.1",
60
60
  "playwright": "^1.41.2",
@@ -65,5 +65,5 @@
65
65
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
66
66
  "license": "BSD-3-Clause",
67
67
  "description": "",
68
- "gitHead": "c5c699c6f29b735dd1597ddf572a8b956b338329"
68
+ "gitHead": "852e9817a89ffe5f2b6dc13c658d7a1bfd4f8fa6"
69
69
  }