|
|
@@ -25,7 +25,7 @@
|
|
|
@click="enterImmersive"
|
|
|
>
|
|
|
<IonSpinner
|
|
|
- v-if="!series || !episode"
|
|
|
+ v-if="!series || !episode || loading"
|
|
|
name="crescent"
|
|
|
class="absolute left-0 top-0 right-0 bottom-0 m-auto text-lg"
|
|
|
/>
|
|
|
@@ -79,7 +79,7 @@
|
|
|
ref="progressBar"
|
|
|
>
|
|
|
<div
|
|
|
- v-if="loading"
|
|
|
+ v-if="loading || videoLoading"
|
|
|
class="loading bg-white h-[2px] rounded bg-opacity-80"
|
|
|
></div>
|
|
|
<div
|
|
|
@@ -89,15 +89,17 @@
|
|
|
></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="dive-into h-[44px] flex items-center text-xs bg-opacity-20 bg-black px-4 rounded"
|
|
|
- @click.stop="showEpisodesModal = true"
|
|
|
- >
|
|
|
- <IonIcon :icon="filter" class="text-base" />
|
|
|
- <div class="flex-1 ml-2 text-white text-opacity-80">
|
|
|
- {{ series?.totalEpisodes }} Episodes
|
|
|
+ <div class="pb-4" style="padding-bottom: env(--ion-safe-area-bottom);">
|
|
|
+ <div
|
|
|
+ class="dive-into mb-4 h-[44px] flex items-center text-xs bg-opacity-20 bg-black px-4 rounded"
|
|
|
+ @click.stop="showEpisodesModal = true"
|
|
|
+ >
|
|
|
+ <IonIcon :icon="filter" class="text-base" />
|
|
|
+ <div class="flex-1 ml-2 text-white text-opacity-80">
|
|
|
+ {{ series?.totalEpisodes }} Episodes
|
|
|
+ </div>
|
|
|
+ <IonIcon :icon="chevronForward" class="text-base" />
|
|
|
</div>
|
|
|
- <IonIcon :icon="chevronForward" class="text-base" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -262,6 +264,7 @@ const progress = computed(() => {
|
|
|
return (currentTime.value / duration.value) * 100;
|
|
|
});
|
|
|
const loading = ref(false);
|
|
|
+const videoLoading = ref(false);
|
|
|
const dragTarget = ref();
|
|
|
const progressBar: Ref<HTMLElement | null> = ref(null);
|
|
|
const draggingData = reactive({
|
|
|
@@ -320,22 +323,23 @@ const dragHandler = ({ movement: [x, y], dragging }: any) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-function getEpisode() {
|
|
|
+async function getEpisode() {
|
|
|
if (!props.episode) return;
|
|
|
loading.value = true;
|
|
|
try {
|
|
|
- http.get(`/episodes/${props.episode?.id}`).then((res) => {
|
|
|
- if (res.playUrl) {
|
|
|
- playUrl.value = res.playUrl;
|
|
|
- } else {
|
|
|
- needPay.value = true;
|
|
|
- }
|
|
|
- if (props.active) {
|
|
|
- nextTick(() => {
|
|
|
- onPlay();
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ // await new Promise((resolve) => setTimeout(resolve, 1000000));
|
|
|
+ const res = await http.get(`/episodes/${props.episode?.id}`);
|
|
|
+ if (res.playUrl) {
|
|
|
+ needPay.value = false;
|
|
|
+ playUrl.value = res.playUrl;
|
|
|
+ } else {
|
|
|
+ needPay.value = true;
|
|
|
+ }
|
|
|
+ if (props.active) {
|
|
|
+ nextTick(() => {
|
|
|
+ onPlay();
|
|
|
+ });
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.error(error);
|
|
|
}
|
|
|
@@ -395,6 +399,7 @@ async function onPlay() {
|
|
|
}
|
|
|
}
|
|
|
if (playUrl.value) {
|
|
|
+ videoLoading.value = true;
|
|
|
playing.value = true;
|
|
|
} else if (needPay.value) {
|
|
|
emit("pay");
|
|
|
@@ -426,6 +431,8 @@ function exitImmersive() {
|
|
|
}
|
|
|
|
|
|
function onVideoDidPlay() {
|
|
|
+ console.log("videoDidplay");
|
|
|
+ videoLoading.value = false;
|
|
|
clearTimeout(videoPlayTimeout.value);
|
|
|
videoPlayTimeout.value = setTimeout(enterImmersive, 3000);
|
|
|
}
|
|
|
@@ -437,6 +444,7 @@ function onVideoDidPause() {
|
|
|
watchThrottled(
|
|
|
currentTime,
|
|
|
() => {
|
|
|
+ videoLoading.value = false;
|
|
|
emit("progress", {
|
|
|
seriesId: props.series?.id,
|
|
|
episodeId: props.episode?.id,
|