/
VideoPlayer.vue
72 lines (67 loc) · 1.68 KB
/
VideoPlayer.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
<div class="modal-content fm-modal-video-player">
<div class="modal-header">
<h5 class="modal-title w-75 text-truncate">
{{ lang.modal.videoPlayer.title }} <small class="text-muted pl-3">{{ videoFile.basename }}</small>
</h5>
<button type="button" class="close" aria-label="Close" v-on:click="hideModal">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<video ref="fmVideo" controls></video>
</div>
</div>
</template>
<script>
import Plyr from 'plyr';
import modal from './../mixins/modal';
import translate from './../../../mixins/translate';
export default {
name: 'Player',
mixins: [modal, translate],
data() {
return {
player: {},
};
},
mounted() {
// initiate video player
this.player = new Plyr(this.$refs.fmVideo);
// load source
this.player.source = {
type: 'video',
title: this.videoFile.filename,
sources: [{
src: `${this.$store.getters['fm/settings/baseUrl']}stream-file?disk=${this.selectedDisk}&path=${encodeURIComponent(this.videoFile.path)}`,
type: `audio/${this.videoFile.extension}`,
}],
};
},
beforeDestroy() {
this.player.destroy();
},
computed: {
/**
* Selected disk
* @returns {*}
*/
selectedDisk() {
return this.$store.getters['fm/selectedDisk'];
},
/**
* Video file
* @returns {*}
*/
videoFile() {
return this.$store.getters['fm/selectedItems'][0];
},
},
methods: {
},
};
</script>
<style lang="scss">
.fm-modal-video-player {
}
</style>