mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2025-01-20 22:10:20 +00:00
fix(capture): enable/disable capture button
This commit is contained in:
parent
81d0919f2a
commit
bcf1dc9b52
2 changed files with 9 additions and 2 deletions
|
@ -40,6 +40,8 @@ export default new Vuex.Store({
|
||||||
if (state.mediaStream) {
|
if (state.mediaStream) {
|
||||||
state.mediaStream.getTracks().forEach(track => track.stop())
|
state.mediaStream.getTracks().forEach(track => track.stop())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.mediaStream = null
|
||||||
},
|
},
|
||||||
inverseFacingMode (store) {
|
inverseFacingMode (store) {
|
||||||
store.capturing.shouldFaceUser = !store.capturing.shouldFaceUser
|
store.capturing.shouldFaceUser = !store.capturing.shouldFaceUser
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
<capture-options v-else></capture-options>
|
<capture-options v-else></capture-options>
|
||||||
|
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<video ref="preview" class="preview-visual" preload="yes" :srcObject.prop="mediaStream" autoplay muted playsinline webkit-playsinline></video>
|
<video ref="preview" class="preview-visual" preload="yes" autoplay muted playsinline webkit-playsinline></video>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="capture-btn" :class="{ 'capture-btn--capturing': capturing.status }" @click.prevent="startCapture">Capture</button>
|
<button class="capture-btn" :class="{ 'capture-btn--capturing': capturing.status }" @click.prevent="startCapture" :disabled="!mediaStream">Capture</button>
|
||||||
|
|
||||||
<encoding-overlay v-if="encoding.status"></encoding-overlay>
|
<encoding-overlay v-if="encoding.status"></encoding-overlay>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,6 +44,11 @@ export default {
|
||||||
this.$store.dispatch('capture')
|
this.$store.dispatch('capture')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
mediaStream: function (mediaStream) {
|
||||||
|
this.$refs.preview.srcObject = mediaStream
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
window.objectFitPolyfill(this.$refs.preview)
|
window.objectFitPolyfill(this.$refs.preview)
|
||||||
document.body.classList.add('capture-body')
|
document.body.classList.add('capture-body')
|
||||||
|
|
Loading…
Reference in a new issue