chrome/android์์ getCameras()๋ฅผ ์๋ํ ๋ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
๋๋ https์์ด localhost๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
Uncaught (in promise) {name: "NotReadableError", message: "Could not start video source", constraint: undefined, toString: ฦ}constraint: undefinedmessage: "Could not start video source"name: "NotReadableError"toString: ฦ ()__proto__: constructor: ฦ Object()hasOwnProperty: ฦ hasOwnProperty()isPrototypeOf: ฦ isPrototypeOf()propertyIsEnumerable: ฦ propertyIsEnumerable()toLocaleString: ฦ toLocaleString()toString: ฦ toString()valueOf: ฦ valueOf()__defineGetter__: ฦ __defineGetter__()__defineSetter__: ฦ __defineSetter__()__lookupGetter__: ฦ __lookupGetter__()__lookupSetter__: ฦ __lookupSetter__()get __proto__: ฦ __proto__()set __proto__: ฦ __proto__()
step @ instascan.js:44
(anonymous) @ instascan.js:54
Promise.then (async)
step @ instascan.js:51
(anonymous) @ instascan.js:59
F @ instascan.js:416
(anonymous) @ instascan.js:38
start @ instascan.js:23709
getCameras @ QRScan.vue?54e3:51
Promise.then (async)
mounted @ QRScan.vue?54e3:68
callHook @ vue.esm.js?65d7:2921
insert @ vue.esm.js?65d7:4158
invokeInsertHook @ vue.esm.js?65d7:5960
patch @ vue.esm.js?65d7:6179
Vue._update @ vue.esm.js?65d7:2670
updateComponent @ vue.esm.js?65d7:2788
get @ vue.esm.js?65d7:3142
run @ vue.esm.js?65d7:3219
flushSchedulerQueue @ vue.esm.js?65d7:2981
(anonymous) @ vue.esm.js?65d7:1837
flushCallbacks @ vue.esm.js?65d7:1758
์์ฒด ์๋ช ์ธ์ฆ์๋ฅผ ์ถ๊ฐํ์ฌ https://localhost :8443์ ์ฌ์ฉํ๊ณ ์์ง๋ง ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์์ต๋๋ค.
์ด๊ฒ์ Android 7์์๋ง ๋ฌธ์ ์ ๋๋ค.
Android ๋ฒ์ 4.1.2์์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ํ๋ก ํธ ์บ ์ ๋ฌธ์ ์์ง๋ง ๋ฆฌ์ด ์บ ์ ๊ฐ์ ์๋ฌ๊ฐ ๋ฉ๋๋ค.
ํ ์คํธํ ๋ชจ๋ ๋ธ๋ผ์ฐ์ ์์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
ํด๊ฒฐ์ฑ ์ ์ฐพ์์ต๋๊น?
Chrome Android์ ํ๋ก์ ํธ(instascan๊ณผ ๊ด๋ จ์ด ์์)์ ๋น์ทํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
์นด๋ฉ๋ผ๋ฅผ ์ ํํ๋ ค๊ณ ํ ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
๋๋ฅผ ์ํ ํด๊ฒฐ์ฑ
์ ์ ํธ๋์ ํ๋ํ๊ธฐ ์ ์ ํ์ฑ ์คํธ๋ฆผ์ ๋ชจ๋ ํธ๋์ ์ค์งํ๋ ๊ฒ์ด์์ต๋๋ค.
if(this.lastStream) {
this.lastStream.getTracks().forEach(track => track.stop())
}
๊ทธ ํ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค
Chrome Android์ ํ๋ก์ ํธ(instascan๊ณผ ๊ด๋ จ์ด ์์)์ ๋น์ทํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
์นด๋ฉ๋ผ๋ฅผ ์ ํํ๋ ค๊ณ ํ ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
๋๋ฅผ ์ํ ํด๊ฒฐ์ฑ ์ ์ ํธ๋์ ํ๋ํ๊ธฐ ์ ์ ํ์ฑ ์คํธ๋ฆผ์ ๋ชจ๋ ํธ๋์ ์ค์งํ๋ ๊ฒ์ด์์ต๋๋ค.if(this.lastStream) { this.lastStream.getTracks().forEach(track => track.stop()) }
๊ทธ ํ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค
์ ๋ฅ์ฅ์ด ์ด๋์ธ์ง ๊ถ๊ธํ์ ๋ถ๋ค์ ์ํด navigator.mediaDevices.getUserMedia
๋ฐ๋ก ์์ ์์ต๋๋ค.
@Kukunin๋ โโ๊ฐ์ฌํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
Chrome Android์ ํ๋ก์ ํธ(instascan๊ณผ ๊ด๋ จ์ด ์์)์ ๋น์ทํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
์นด๋ฉ๋ผ๋ฅผ ์ ํํ๋ ค๊ณ ํ ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
๋๋ฅผ ์ํ ํด๊ฒฐ์ฑ ์ ์ ํธ๋์ ํ๋ํ๊ธฐ ์ ์ ํ์ฑ ์คํธ๋ฆผ์ ๋ชจ๋ ํธ๋์ ์ค์งํ๋ ๊ฒ์ด์์ต๋๋ค.
๊ทธ ํ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค