Request based on filename

This commit is contained in:
2021-12-30 19:57:06 +03:00
parent 52d8664134
commit 307f92e4f7
2 changed files with 4 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ export interface Room {
magnet: string; magnet: string;
createdAt: Date; createdAt: Date;
movie?: string; movie?: string;
filename?: string;
downloaded?: boolean; downloaded?: boolean;
downloadedAt?: Date; downloadedAt?: Date;
position: number; position: number;

View File

@@ -12,12 +12,12 @@
<video <video
v-if="room.downloaded" v-if="room.downloaded"
controls controls
:src="movieUrl"
ref="video" ref="video"
@seeked="seeked" @seeked="seeked"
@play="playing = true" @play="playing = true"
@pause="playing = false" @pause="playing = false"
> >
<source :src="movieUrl" type="video/mp4">
</video> </video>
</div> </div>
</template> </template>
@@ -55,7 +55,7 @@ export default defineComponent({
}, },
computed: { computed: {
movieUrl() { movieUrl() {
return `${process.env.VUE_APP_MOVIES}?id=${this.room.id}`; return `${process.env.VUE_APP_MOVIES}?filename=${this.room.filename}`;
}, },
progressPerc() { progressPerc() {
return Math.floor(this.progress * 100); return Math.floor(this.progress * 100);
@@ -68,7 +68,7 @@ export default defineComponent({
this.progressInterval = setInterval(async () => { this.progressInterval = setInterval(async () => {
const result = await getStatus(this.id); const result = await getStatus(this.id);
this.progress = result.progress; this.progress = result.progress;
if (result.downloaded) { if (result.downloaded || this.progress === 1) {
this.room.downloaded = true; this.room.downloaded = true;
clearInterval(this.progressInterval); clearInterval(this.progressInterval);
} }