mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2025-02-01 11:39:38 +00:00
feat(encoding overlay): Show a simple percentage of the progress
This commit is contained in:
parent
6b893f272d
commit
55d86cc642
2 changed files with 19 additions and 3 deletions
12
src/store.js
12
src/store.js
|
@ -21,7 +21,8 @@ export default new Vuex.Store({
|
||||||
state: 0
|
state: 0
|
||||||
},
|
},
|
||||||
encoding: {
|
encoding: {
|
||||||
status: false
|
status: false,
|
||||||
|
progress: 0
|
||||||
},
|
},
|
||||||
downloading: {
|
downloading: {
|
||||||
status: false,
|
status: false,
|
||||||
|
@ -64,6 +65,9 @@ export default new Vuex.Store({
|
||||||
stopEncoding (store) {
|
stopEncoding (store) {
|
||||||
store.encoding.status = false
|
store.encoding.status = false
|
||||||
},
|
},
|
||||||
|
updateEncodingProgress (store, progress) {
|
||||||
|
store.encoding.progress = progress
|
||||||
|
},
|
||||||
startDownloading (store, objectUrl) {
|
startDownloading (store, objectUrl) {
|
||||||
store.downloading.status = true
|
store.downloading.status = true
|
||||||
store.downloading.objectUrl = objectUrl
|
store.downloading.objectUrl = objectUrl
|
||||||
|
@ -132,10 +136,14 @@ export default new Vuex.Store({
|
||||||
|
|
||||||
encoding.once('error', error => console.error(error))
|
encoding.once('error', error => console.error(error))
|
||||||
|
|
||||||
encoding.on('progress', value => console.log(`Encoding progress ${Math.round(value * 100)}% (${value})`))
|
encoding.on('progress', value => {
|
||||||
|
console.log(`Encoding progress ${Math.round(value * 100)}% (${value})`)
|
||||||
|
commit('updateEncodingProgress', Math.round(value * 100))
|
||||||
|
})
|
||||||
|
|
||||||
encoding.once('done', objectUrl => {
|
encoding.once('done', objectUrl => {
|
||||||
commit('stopEncoding')
|
commit('stopEncoding')
|
||||||
|
commit('updateEncodingProgress', 0)
|
||||||
commit('startDownloading', objectUrl)
|
commit('startDownloading', objectUrl)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
<template lang="html">
|
<template lang="html">
|
||||||
<div class="encoding">
|
<div class="encoding">
|
||||||
Encoding {{ ellipsis }}
|
Encoding {{ ellipsis }}<br/>
|
||||||
|
{{ encoding.progress }}%
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'encodingOverlay',
|
name: 'encodingOverlay',
|
||||||
data () {
|
data () {
|
||||||
|
@ -13,6 +16,11 @@ export default {
|
||||||
interval: null
|
interval: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState([
|
||||||
|
'encoding'
|
||||||
|
])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
makeLoading () {
|
makeLoading () {
|
||||||
// Dot loading
|
// Dot loading
|
||||||
|
|
Loading…
Add table
Reference in a new issue