Compare commits

..

No commits in common. "ff7bb569fccb96eb5b8a52373ed6729f383f7320" and "4b266c47389fb98405cb634a6e5841e45ea9b285" have entirely different histories.

6 changed files with 79 additions and 113 deletions

View File

@ -153,6 +153,7 @@ export default {
} }
// Try to fix SAFARI // Try to fix SAFARI
this.audio.play(); this.audio.play();
}, },
pushHistoryItem() { pushHistoryItem() {
if (!this.currentUser._id) { if (!this.currentUser._id) {

View File

@ -1,14 +1,26 @@
<template> <template>
<DialogBase ref="dialogWindow" :title="selectedBox.title" @canceled="closed" :showFooter="false" :closeOnEscape="selectedVideo._id == null" :disableXscroll="true" :disableYscroll="true"> <DialogBase
ref="dialogWindow"
:title="selectedBox.title"
@canceled="closed"
:showFooter="false"
:closeOnEscape="selectedVideo._id == null"
:disableXscroll="true"
:disableYscroll="true"
>
<div id="boxViewer" class="flex-row"> <div id="boxViewer" class="flex-row">
<div id="header" class="flex-column"> <div id="header" class="flex-column">
<div id="background" :style="coverBackground" /> <div id="background" :style="coverBackground" />
<div class="grow z1 center flex-column"> <div class="grow z1 center flex-column">
<img class="glow ma24" :src="cover" @dblclick="dblclick" /> <img class="glow ma24" :src="cover" @dblclick="dblclick" />
</div> </div>
<awesome-icon icon="star" size="2x" class="favourite ma4 z2" :class="{ active: isFavourite }" @click="toggleFavourite" /> <awesome-icon
<awesome-icon icon="play" size="2x" class="keepPlaying ma4 primary-text" @click="playProgress" v-if="selectedBox.progress" title="Keep playing" /> icon="star"
size="2x"
class="favourite ma4 z2"
:class="{ active: isFavourite }"
@click="toggleFavourite"
/>
<div id="stats" class="flex-row z1"> <div id="stats" class="flex-row z1">
<DropDown v-if="$store.getters['user/isAdministrator']"> <DropDown v-if="$store.getters['user/isAdministrator']">
<button class="flat center" :title="visibility_text"> <button class="flat center" :title="visibility_text">
@ -16,7 +28,11 @@
</button> </button>
<template v-slot:dropdown-content> <template v-slot:dropdown-content>
<div> <div>
<button v-for="(item, i) in $store.state.system.lists.visibility" :key="i" @click="setVisibility(item)"> <button
v-for="(item, i) in $store.state.system.lists.visibility"
:key="i"
@click="setVisibility(item)"
>
<awesome-icon :icon="getVisibilityIcon(item)" />{{ <awesome-icon :icon="getVisibilityIcon(item)" />{{
getVisibilityText(item) getVisibilityText(item)
}} }}
@ -25,7 +41,10 @@
<button v-if="!selectedBox.share._id" @click="shareEnable"> <button v-if="!selectedBox.share._id" @click="shareEnable">
<awesome-icon icon="share" />Share this box <awesome-icon icon="share" />Share this box
</button> </button>
<button v-if="selectedBox.share._id" @click="addShareUrlToClipboard"> <button
v-if="selectedBox.share._id"
@click="addShareUrlToClipboard"
>
<awesome-icon icon="clipboard" />Copy url into clipboard <awesome-icon icon="clipboard" />Copy url into clipboard
</button> </button>
<button v-if="selectedBox.share._id" @click="shareDisable"> <button v-if="selectedBox.share._id" @click="shareDisable">
@ -102,14 +121,6 @@ export default {
} }
} }
}, },
playProgress() {
let video = this.selectedBox.videos.find(
(f) => f._id == this.selectedBox.progress.id
);
if (video) {
this.$store.dispatch("videos/play", video);
}
},
gotoNextBox() { gotoNextBox() {
this.$store.dispatch("boxes/gotoNextBox"); this.$store.dispatch("boxes/gotoNextBox");
}, },
@ -181,15 +192,6 @@ export default {
shareDisable() { shareDisable() {
this.$store.dispatch("boxes/shareDisable", this.selectedBox); this.$store.dispatch("boxes/shareDisable", this.selectedBox);
}, },
loadUserProgress() {
if (this.selectedVideo.parent._id != this.selectedBox._id) {
this.$store
.dispatch("user/getProgress", this.selectedBox)
.then(() => {
this.gotoVideo();
});
}
}
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
@ -247,7 +249,7 @@ export default {
this.$refs.dialogWindow.open(); this.$refs.dialogWindow.open();
window.addEventListener("keydown", this.keydownListener); window.addEventListener("keydown", this.keydownListener);
} }
this.loadUserProgress(); this.gotoVideo();
} else { } else {
if (this.$refs.dialogWindow.visible) { if (this.$refs.dialogWindow.visible) {
this.$refs.dialogWindow.close(); this.$refs.dialogWindow.close();
@ -267,17 +269,14 @@ export default {
#boxViewer { #boxViewer {
height: 462px; height: 462px;
} }
#header { #header {
position: relative; position: relative;
background-color: black; background-color: black;
} }
#header img { #header img {
align-self: center; align-self: center;
width: 256px; width: 256px;
} }
#stats { #stats {
z-index: 2; z-index: 2;
align-items: center; align-items: center;
@ -288,23 +287,19 @@ export default {
border-top: 1px solid #ffffff20; border-top: 1px solid #ffffff20;
border-bottom: 1px solid #00000020; border-bottom: 1px solid #00000020;
} }
.dropdown-activator button { .dropdown-activator button {
width: 32px; width: 32px;
height: 32px; height: 32px;
} }
#stats p { #stats p {
max-width: 192px; max-width: 192px;
align-self: center; align-self: center;
} }
#videoList { #videoList {
background-color: var(--white); background-color: var(--white);
z-index: 1; z-index: 1;
overflow: overlay; overflow: overlay;
} }
.video { .video {
width: 220px; width: 220px;
} }
@ -313,32 +308,26 @@ export default {
#boxViewer { #boxViewer {
flex-direction: column; flex-direction: column;
} }
#stats p { #stats p {
max-width: initial; max-width: initial;
} }
} }
@media (max-width: 480px), (max-height: 480px) {
@media (max-width: 480px),
(max-height: 480px) {
#boxViewer { #boxViewer {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
#header img { #header img {
width: 192px; width: 192px;
} }
#videoList { #videoList {
height: initial; height: initial;
flex-grow: 1; flex-grow: 1;
} }
.video { .video {
width: initial; width: initial;
} }
} }
@media (max-height: 480px) {
@media (max-height: 480px) {} }
</style> </style>

View File

@ -1,14 +1,37 @@
<template> <template>
<DialogBase ref="dialogWindow" @closing="closing" :showFooter="false" :showFullscreenButton="true"> <DialogBase
ref="dialogWindow"
@closing="closing"
:showFooter="false"
:showFullscreenButton="true"
>
<template v-slot:header-right> <template v-slot:header-right>
<span v-if="selectedVideo.tracks && selectedVideo.tracks.length > 1">Language:</span> <span v-if="selectedVideo.tracks && selectedVideo.tracks.length > 1"
<select v-if="selectedVideo.tracks && selectedVideo.tracks.length > 1" @change="langChanged" v-model="selectedLang"> >Language:</span
<option v-for="(lang, i) in selectedVideo.tracks" :key="i" :value="lang" :title="lang.title"> >
<select
v-if="selectedVideo.tracks && selectedVideo.tracks.length > 1"
@change="langChanged"
v-model="selectedLang"
>
<option
v-for="(lang, i) in selectedVideo.tracks"
:key="i"
:value="lang"
:title="lang.title"
>
{{ lang.lang.toUpperCase() }} {{ lang.lang.toUpperCase() }}
</option> </option>
</select> </select>
</template> </template>
<video @ended="nextVideo" @timeupdate="timeUpdate" @playing="playing" @pause="pause" controls style="height: 100%; width: 100%; background: black" ref="videoControl" src></video> <video
@ended="nextVideo"
@timeupdate="timeUpdate"
controls
style="height: 100%; width: 100%; background: black"
ref="videoControl"
src
></video>
</DialogBase> </DialogBase>
</template> </template>
<script> <script>
@ -19,7 +42,6 @@ export default {
languages: [], languages: [],
selectedLang: {}, selectedLang: {},
preConvert: false, preConvert: false,
intervalState: 0,
}; };
}, },
methods: { methods: {
@ -28,30 +50,6 @@ export default {
this.$store.getters["videos/getStreamUrl"] + this.langIndex; this.$store.getters["videos/getStreamUrl"] + this.langIndex;
this.video.play(); this.video.play();
}, },
pause() {
window.clearInterval(this.intervalState);
},
playing() {
window.clearInterval(this.intervalState);
this.pushState();
this.intervalState = setInterval(() => {
this.pushState();
}, 10000);
},
pushState() {
if (!this.currentUser._id || !this.video || !this.selectedVideo._id) {
return;
}
let item = {
id: this.selectedVideo._id,
parentId: this.selectedVideo.parent._id,
type: "video",
progress: Math.round(this.video.currentTime)
}
this.$store.dispatch("user/saveProgress", item);
},
playVideo(video) { playVideo(video) {
this.$store.commit("radios/resetSelectedRadio"); this.$store.commit("radios/resetSelectedRadio");
this.$store.commit("tracks/resetSelectedTrack"); this.$store.commit("tracks/resetSelectedTrack");
@ -83,13 +81,6 @@ export default {
this.video.src = this.video.src =
this.$store.getters["videos/getStreamUrl"] + this.langIndex; this.$store.getters["videos/getStreamUrl"] + this.langIndex;
if (this.selectedVideo.parent.progress) {
if (this.selectedVideo.parent.progress.id == this.selectedVideo._id) {
this.skipToSecond(this.selectedVideo.parent.progress.progress);
}
this.selectedVideo.parent.progress = undefined;
}
this.video.play(); this.video.play();
this.pushHistoryItem(); this.pushHistoryItem();
@ -129,22 +120,7 @@ export default {
}); });
} }
}, },
reset() {
if (this.$refs.dialogWindow.visible) {
this.$refs.dialogWindow.close();
}
},
skipToSecond(second) {
let was_paused = this.video.paused;
this.video.pause();
this.video.currentTime = second;
if (!was_paused) {
this.video.play();
}
},
closing() { closing() {
window.clearInterval(this.intervalState);
this.pushState();
this.video = undefined; this.video = undefined;
this.$store.dispatch("videos/resetSelectedVideo"); this.$store.dispatch("videos/resetSelectedVideo");
}, },
@ -196,7 +172,9 @@ export default {
if (newVal._id) { if (newVal._id) {
this.playVideo(newVal); this.playVideo(newVal);
} else { } else {
this.reset(); if (this.$refs.dialogWindow.visible) {
this.$refs.dialogWindow.close();
}
} }
}, },
}, },

View File

@ -16,8 +16,6 @@ export default {
let currentIndex = video.parent.videos.indexOf(video); let currentIndex = video.parent.videos.indexOf(video);
if (currentIndex < video.parent.videos.length - 1) { if (currentIndex < video.parent.videos.length - 1) {
context.dispatch("play", video.parent.videos[currentIndex + 1]); context.dispatch("play", video.parent.videos[currentIndex + 1]);
} else {
this.dispatch("user/resetProgress", video.parent._id);
} }
}, },
convertNextTo(context, payload) { convertNextTo(context, payload) {

View File

@ -6,7 +6,7 @@ export default {
if (!state.selectedVideo._id) { if (!state.selectedVideo._id) {
return; return;
} }
state.selectedVideo = { tracks: [], parent: { title: "", covers: {} } }; state.selectedVideo = { tracks: [] };
}, },
setMostViewed(state, tracks) { setMostViewed(state, tracks) {
state.mostViewed = tracks; state.mostViewed = tracks;

View File

@ -1,4 +1,4 @@
export default { export default {
selectedVideo: { tracks: [], parent: { title: "", covers: {} } }, selectedVideo: { tracks: [] },
mostViewed: [] mostViewed: []
} }