mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2025-01-20 18:50:21 +00:00
fix(capture): Handle when camera isn't allowed
This commit is contained in:
parent
a3d6e2f4b9
commit
d75e606b1e
2 changed files with 11 additions and 12 deletions
13
src/store.js
13
src/store.js
|
@ -98,16 +98,9 @@ export default new Vuex.Store({
|
||||||
? !state.capturing.shouldFaceUser
|
? !state.capturing.shouldFaceUser
|
||||||
: state.capturing.shouldFaceUser
|
: state.capturing.shouldFaceUser
|
||||||
|
|
||||||
try {
|
commit('startCamera', await getCamera(shouldFaceUser))
|
||||||
commit('startCamera', await getCamera(shouldFaceUser))
|
if (inverseFacingMode) {
|
||||||
|
commit('inverseFacingMode')
|
||||||
if (inverseFacingMode) {
|
|
||||||
commit('inverseFacingMode')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
window.alert('You haven\'t allowed to use your camera.\n\nOr maybe your browser is not compatible :(')
|
|
||||||
commit('updateWelcomed', false)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
capture ({ state, commit, dispatch }) {
|
capture ({ state, commit, dispatch }) {
|
||||||
|
|
|
@ -49,9 +49,15 @@ export default {
|
||||||
await this.$store.dispatch('encode', captureData)
|
await this.$store.dispatch('encode', captureData)
|
||||||
this.$router.push({ name: 'download' })
|
this.$router.push({ name: 'download' })
|
||||||
},
|
},
|
||||||
ensureCameraStarted () {
|
async ensureCameraStarted () {
|
||||||
if (!this.mediaStream) {
|
if (!this.mediaStream) {
|
||||||
this.$store.dispatch('requestCamera', false)
|
try {
|
||||||
|
await this.$store.dispatch('requestCamera', false)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
window.alert('You haven\'t allowed to use your camera.\n\nOr maybe your browser is not compatible :(')
|
||||||
|
this.$router.push({ name: 'home' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleVisibilityChange (event) {
|
handleVisibilityChange (event) {
|
||||||
|
|
Loading…
Reference in a new issue