mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2025-01-20 22:30:20 +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 WIDTH = 200
|
||||||
const HEIGHT = WIDTH
|
const HEIGHT = WIDTH
|
||||||
|
|
||||||
|
|
||||||
export function capture (commit, mediaStream, duration) {
|
export function capture (commit, mediaStream, duration) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const video = document.createElement('video')
|
const video = document.createElement('video')
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
} from 'gif-writer'
|
} from 'gif-writer'
|
||||||
|
|
||||||
onmessage = (event) => {
|
onmessage = (event) => {
|
||||||
console.log(event.data)
|
|
||||||
const { imageDataList, imageWidth, imageHeight, paletteSize, delayTime } = event.data
|
const { imageDataList, imageWidth, imageHeight, paletteSize, delayTime } = event.data
|
||||||
|
|
||||||
console.log('Write GIF')
|
console.log('Write GIF')
|
||||||
|
|
|
@ -22,7 +22,8 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
downloading: {
|
downloading: {
|
||||||
status: false,
|
status: false,
|
||||||
dataUrl: null
|
dataUrl: null,
|
||||||
|
timestamp: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
@ -54,10 +55,12 @@ export default new Vuex.Store({
|
||||||
startDownloading (store, dataUrl) {
|
startDownloading (store, dataUrl) {
|
||||||
store.downloading.status = true
|
store.downloading.status = true
|
||||||
store.downloading.dataUrl = dataUrl
|
store.downloading.dataUrl = dataUrl
|
||||||
|
store.downloading.timestamp = Date.now()
|
||||||
},
|
},
|
||||||
stopDownloading (store) {
|
stopDownloading (store) {
|
||||||
store.downloading.status = false
|
store.downloading.status = false
|
||||||
store.downloading.dataUrl = null
|
store.downloading.dataUrl = null
|
||||||
|
store.downloading.timestamp = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<img class="preview-visual" :src="downloading.dataUrl" alt="">
|
<img class="preview-visual" :src="downloading.dataUrl" alt="">
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue