Skip to content

Commit

Permalink
Merge pull request #1300 from CodeCrowCorp/dev
Browse files Browse the repository at this point in the history
Feat: vod downloads
  • Loading branch information
gagansuie authored Jun 24, 2024
2 parents 289d5c5 + c2fdc25 commit 08219ac
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage-website",
"version": "0.3.02",
"version": "0.3.03",
"license": "GPL-3.0",
"private": true,
"type": "module",
Expand Down
32 changes: 24 additions & 8 deletions src/lib/components/Channel/Stream/DialogVod.svelte
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
<script lang="ts">
import { patch } from '$lib/api'
import { page } from '$app/stores'
import { get, patch } from '$lib/api'
import IconMore from '$lib/assets/icons/IconMore.svelte'
import { is_vod_modal_open } from '$lib/stores/channelStore'
import { timeSince } from '$lib/utils'
export let vod: any, isHost: boolean
$: vodIsVisible = vod?.isVisible
let downloadUrl = ''
$: if (vod) {
getDownloadUrl().then((url) => (downloadUrl = url))
}
const toggleVodVisibility = async () => {
const updatedVod = await patch(`vod`, {
channelId: vod.channelId,
uid: vod.uid,
inputId: vod.inputId,
isVisible: !vod.isVisible
})
const updatedVod = await patch(
`vod`,
{
channelId: vod.channelId,
uid: vod.uid,
inputId: vod.inputId,
isVisible: !vod.isVisible
},
{ userId: $page.data.user?.userId, token: $page.data.user?.token }
)
vod.isVisible = updatedVod.isVisible
}
const getDownloadUrl = async () => {
return await get(`vod/download-url?videoUid=${vod?.uid}&createdAt=${vod?.createdAt}`, {
userId: $page.data.user?.userId,
token: $page.data.user?.token
})
}
</script>

<!-- svelte-ignore a11y-click-events-have-key-events -->
Expand Down Expand Up @@ -50,7 +66,7 @@
bind:checked={vodIsVisible} />
Visible to viewers</a>
</li>
<!-- <li><a>Download</a></li> -->
<li><a href={downloadUrl} target="_blank">Download</a></li>
</ul>
</div>
{/if}
Expand Down

0 comments on commit 08219ac

Please sign in to comment.