feat: dynamic autoplay on previewer
parent
2697093ac1
commit
a76e01d2b7
|
@ -57,8 +57,22 @@
|
||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
||||||
<audio v-else-if="req.type == 'audio'" :src="raw" controls></audio>
|
<audio
|
||||||
<video v-else-if="req.type == 'video'" :src="raw" controls>
|
v-else-if="req.type == 'audio'"
|
||||||
|
ref="player"
|
||||||
|
:src="raw"
|
||||||
|
controls
|
||||||
|
:autoplay="autoPlay"
|
||||||
|
@play="autoPlay = true"
|
||||||
|
></audio>
|
||||||
|
<video
|
||||||
|
v-else-if="req.type == 'video'"
|
||||||
|
ref="player"
|
||||||
|
:src="raw"
|
||||||
|
controls
|
||||||
|
:autoplay="autoPlay"
|
||||||
|
@play="autoPlay = true"
|
||||||
|
>
|
||||||
<track
|
<track
|
||||||
kind="captions"
|
kind="captions"
|
||||||
v-for="(sub, index) in subtitles"
|
v-for="(sub, index) in subtitles"
|
||||||
|
@ -139,6 +153,7 @@ export default {
|
||||||
showNav: true,
|
showNav: true,
|
||||||
navTimeout: null,
|
navTimeout: null,
|
||||||
hoverNav: false,
|
hoverNav: false,
|
||||||
|
autoPlay: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -233,6 +248,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async updatePreview() {
|
async updatePreview() {
|
||||||
|
if (
|
||||||
|
this.$refs.player &&
|
||||||
|
this.$refs.player.paused &&
|
||||||
|
!this.$refs.player.ended
|
||||||
|
) {
|
||||||
|
this.autoPlay = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.req.subtitles) {
|
if (this.req.subtitles) {
|
||||||
this.subtitles = this.req.subtitles.map(
|
this.subtitles = this.req.subtitles.map(
|
||||||
(sub) => `${baseURL}/api/raw${sub}?auth=${this.jwt}&inline=true`
|
(sub) => `${baseURL}/api/raw${sub}?auth=${this.jwt}&inline=true`
|
||||||
|
|
Loading…
Reference in New Issue