{"version":3,"sources":["webpack:///./src/views/recorder/components/DeviceSelect.vue?09c2","webpack:///./src/views/recorder/components/DeviceSelect.vue","webpack:///./src/views/recorder/components/DeviceSelect.vue?0ac9","webpack:///./src/views/recorder/components/DeviceSelect.vue?4f3e","webpack:///./src/views/recorder/lib/devices.ts"],"names":["render","_vm","this","_h","$createElement","_c","_self","VMenu","attrs","scopedSlots","_u","key","fn","ref","on","VBtn","_g","VIcon","_v","_s","type","$t","VList","VListItemGroup","selectedDevice","_l","device","VListItem","id","$event","selectDevice","staticClass","staticStyle","_e","name","staticRenderFns","DeviceSelect","devices","getDevices","getInputDevice","length","get","Vue","__decorate","Prop","default","Component","component","LocalStorage","setInputDevice","setVideoInputDevice","getVideoInputDevice","navigator","mediaDevices","enumerateDevices","console","log","inputDevice","constraints","video","audio","channelCount","echoCancellation","deviceId","undefined","getUserMedia","stream","getTracks","forEach","t","stop","deviceType","inputDevices","filter","x","kind","map","label","error"],"mappings":"iPAQIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAGE,EAAA,KAAM,CAACC,MAAM,CAAC,WAAW,IAAIC,YAAYR,EAAIS,GAAG,CAAC,CAACC,IAAI,YAAYC,GAAG,SAASC,GACjL,IAAIC,EAAKD,EAAIC,GACb,MAAO,CAACT,EAAGU,EAAA,KAAKd,EAAIe,GAAG,CAACR,MAAM,CAAC,KAAO,KAAKM,GAAI,CAACT,EAAGY,EAAA,KAAM,CAACT,MAAM,CAAC,KAAO,KAAK,CAACP,EAAIiB,GAAG,IAAIjB,EAAIkB,GAAgB,UAAblB,EAAImB,KAAmB,iBAAmB,cAAc,OAAOf,EAAG,OAAO,CAACJ,EAAIiB,GAAG,IAAIjB,EAAIkB,GAAgB,UAAblB,EAAImB,KAAmBnB,EAAIoB,GAAG,mBAAqBpB,EAAIoB,GAAG,gBAAgB,OAAOhB,EAAGY,EAAA,KAAM,CAACT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on } from 'vuetify/lib/components/VIcon';\nimport { VList } from 'vuetify/lib/components/VList';\nimport { VListItem } from 'vuetify/lib/components/VList';\nimport { VListItemContent } from 'vuetify/lib/components/VList';\nimport { VListItemGroup } from 'vuetify/lib/components/VList';\nimport { VMenu } from 'vuetify/lib/components/VMenu';\n\nvar render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(VMenu,{attrs:{\"offset-y\":\"\"},scopedSlots:_vm._u([{key:\"activator\",fn:function(ref){\nvar on = ref.on;\nreturn [_c(VBtn,_vm._g({attrs:{\"text\":\"\"}},on),[_c(VIcon,{attrs:{\"left\":\"\"}},[_vm._v(\" \"+_vm._s(_vm.type === \"audio\" ? \"mdi-microphone\" : \"mdi-camera\")+\" \")]),_c('span',[_vm._v(\" \"+_vm._s(_vm.type === \"audio\" ? _vm.$t(\"rec.microphones\") : _vm.$t(\"rec.cameras\"))+\" \")]),_c(VIcon,{attrs:{\"right\":\"\"}},[_vm._v(\"mdi-chevron-down\")])],1)]}}])},[_c(VList,{attrs:{\"dense\":\"\"}},[_c(VListItemGroup,{attrs:{\"value\":_vm.selectedDevice}},_vm._l((_vm.devices),function(device){return _c(VListItem,{key:device.id,attrs:{\"value\":device.id},on:{\"click\":function($event){return _vm.selectDevice(device.id, _vm.type)}}},[(_vm.selectedDevice === device.id)?_c('span',{staticClass:\"green mr-4\",staticStyle:{\"width\":\"8px\",\"height\":\"8px\",\"border-radius\":\"4px\"}}):_vm._e(),_c(VListItemContent,[_vm._v(\" \"+_vm._s(device.name)+\" \")])],1)}),1)],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\r\nimport Vue from \"vue\";\r\nimport { Component, Prop } from \"vue-property-decorator\";\r\nimport {\r\n Device,\r\n getDevices,\r\n selectDevice,\r\n getInputDevice,\r\n} from \"../lib/devices\";\r\n\r\ntype DeviceType = \"video\" | \"audio\";\r\n\r\n@Component\r\nexport default class DeviceSelect extends Vue {\r\n @Prop({ default: \"audio\" }) type!: \"audio\" | \"video\";\r\n\r\n devices: Device[] = [];\r\n selectedDevice = \"\";\r\n\r\n async get() {\r\n this.devices = await getDevices(this.type);\r\n this.selectedDevice = getInputDevice(this.type);\r\n if (!this.selectedDevice && this.devices.length)\r\n this.selectedDevice = this.devices[0].id;\r\n }\r\n async selectDevice(id: string, type: DeviceType = \"audio\") {\r\n this.selectedDevice = id;\r\n //console.log(type, id, this.devices);\r\n selectDevice(id, type);\r\n }\r\n mounted() {\r\n this.get();\r\n }\r\n}\r\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/ts-loader/index.js??ref--15-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DeviceSelect.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/ts-loader/index.js??ref--15-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DeviceSelect.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./DeviceSelect.vue?vue&type=template&id=e4b77814&\"\nimport script from \"./DeviceSelect.vue?vue&type=script&lang=ts&\"\nexport * from \"./DeviceSelect.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","import LocalStorage from \"@/core/utils/LocalStorage\";\r\n\r\ntype DeviceType = \"video\" | \"audio\";\r\nexport interface Device {\r\n id: string;\r\n name: string;\r\n}\r\n\r\nexport const selectDevice = (id: string, type: DeviceType = \"audio\") => {\r\n if (type === \"audio\") LocalStorage.setInputDevice(id);\r\n else LocalStorage.setVideoInputDevice(id);\r\n};\r\n\r\nexport const getInputDevice = (type: DeviceType = \"audio\") => {\r\n return type === \"audio\"\r\n ? LocalStorage.getInputDevice()\r\n : LocalStorage.getVideoInputDevice();\r\n};\r\n\r\nexport const getDevices = async (type: DeviceType = \"audio\") => {\r\n if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {\r\n console.log(\"enumerateDevices() not supported.\");\r\n return [];\r\n }\r\n\r\n const inputDevice = getInputDevice();\r\n const constraints: MediaStreamConstraints =\r\n type === \"audio\"\r\n ? {\r\n video: false,\r\n audio: {\r\n channelCount: 1,\r\n echoCancellation: false,\r\n deviceId: inputDevice ? inputDevice : undefined,\r\n },\r\n }\r\n : {\r\n audio: false,\r\n video: {\r\n deviceId: inputDevice ? inputDevice : undefined,\r\n },\r\n };\r\n\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\r\n stream.getTracks().forEach(t => t.stop());\r\n const devices = await navigator.mediaDevices.enumerateDevices();\r\n\r\n const deviceType: MediaDeviceKind =\r\n type === \"audio\" ? \"audioinput\" : \"videoinput\";\r\n const inputDevices = devices\r\n .filter(x => x.kind === deviceType)\r\n .map(x => ({ id: x.deviceId, name: x.label } as Device));\r\n if (!inputDevice && inputDevices.length > 0)\r\n selectDevice(inputDevices[0].id, type);\r\n return inputDevices;\r\n } catch (error) {\r\n console.error(\"Error getting devices:\", error);\r\n return [];\r\n }\r\n};\r\n"],"sourceRoot":""}