mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2024-11-08 09:11:52 +00:00
add download gif
This commit is contained in:
parent
cbe8785f99
commit
b28aabb5ec
4 changed files with 5 additions and 4 deletions
|
@ -7,7 +7,6 @@ const FRAMES_PER_SECOND = 10
|
|||
const WIDTH = 200
|
||||
const HEIGHT = WIDTH
|
||||
|
||||
|
||||
export function capture (commit, mediaStream, duration) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const video = document.createElement('video')
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
} from 'gif-writer'
|
||||
|
||||
onmessage = (event) => {
|
||||
console.log(event.data)
|
||||
const { imageDataList, imageWidth, imageHeight, paletteSize, delayTime } = event.data
|
||||
|
||||
console.log('Write GIF')
|
||||
|
|
|
@ -22,7 +22,8 @@ export default new Vuex.Store({
|
|||
},
|
||||
downloading: {
|
||||
status: false,
|
||||
dataUrl: null
|
||||
dataUrl: null,
|
||||
timestamp: null
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
@ -54,10 +55,12 @@ export default new Vuex.Store({
|
|||
startDownloading (store, dataUrl) {
|
||||
store.downloading.status = true
|
||||
store.downloading.dataUrl = dataUrl
|
||||
store.downloading.timestamp = Date.now()
|
||||
},
|
||||
stopDownloading (store) {
|
||||
store.downloading.status = false
|
||||
store.downloading.dataUrl = null
|
||||
store.downloading.timestamp = null
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<img class="preview-visual" :src="downloading.dataUrl" alt="">
|
||||
</div>
|
||||
|
||||
<button class="download-btn btn btn--primary w100">Download GIF</button>
|
||||
<a class="download-btn btn btn--primary w100" :href="downloading.dataUrl" :download="`souvenir${downloading.timestamp}.gif`">Download GIF</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in a new issue