-
Notifications
You must be signed in to change notification settings - Fork 891
/
Copy pathwatch-video-playlist.vue
151 lines (150 loc) · 4.71 KB
/
watch-video-playlist.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<template>
<ft-card class="relative">
<ft-loader
v-if="isLoading"
/>
<div
v-else
>
<h3
class="playlistTitle"
:title="playlistTitle"
>
<router-link
class="playlistTitleLink"
:to="playlistPageLinkTo"
>
{{ playlistTitle }}
</router-link>
</h3>
<template
v-if="channelName !== ''"
>
<router-link
v-if="channelId"
class="channelName"
:to="`/channel/${channelId}`"
>
{{ channelName }} -
</router-link>
<span
v-else
class="channelName"
>
{{ channelName }} -
</span>
</template>
<span
class="playlistIndex"
>
<label for="playlistProgressBar">
{{ currentVideoIndexOneBased }} / {{ playlistVideoCount }}
</label>
<progress
v-if="!shuffleEnabled && !reversePlaylist"
id="playlistProgressBar"
class="playlistProgressBar"
:value="currentVideoIndexOneBased"
:max="playlistVideoCount"
/>
</span>
<p>
<font-awesome-icon
class="playlistIcon"
:class="{ playlistIconActive: loopEnabled }"
:icon="['fas', 'retweet']"
:title="$t('Video.Loop Playlist')"
role="button"
tabindex="0"
:aria-pressed="loopEnabled"
@click="toggleLoop"
@keydown.enter.prevent="toggleLoop"
@keydown.space.prevent="toggleLoop"
/>
<font-awesome-icon
class="playlistIcon"
:class="{ playlistIconActive: shuffleEnabled }"
:icon="['fas', 'random']"
:title="$t('Video.Shuffle Playlist')"
role="button"
tabindex="0"
:aria-pressed="shuffleEnabled"
@click="toggleShuffle"
@keydown.enter.prevent="toggleShuffle"
@keydown.space.prevent="toggleShuffle"
/>
<font-awesome-icon
class="playlistIcon"
:class="{ playlistIconActive: reversePlaylist }"
:icon="['fas', 'exchange-alt']"
:title="$t('Video.Reverse Playlist')"
role="button"
tabindex="0"
:aria-pressed="reversePlaylist"
@click="toggleReversePlaylist"
@keydown.enter.prevent="toggleReversePlaylist"
@keydown.space.prevent="toggleReversePlaylist"
/>
<font-awesome-icon
class="playlistIcon"
:icon="['fas', 'step-backward']"
:title="$t('Video.Play Previous Video')"
role="button"
tabindex="0"
@click="playPreviousVideo"
@keydown.enter.prevent="playPreviousVideo"
@keydown.space.prevent="playPreviousVideo"
/>
<font-awesome-icon
class="playlistIcon"
:icon="['fas', 'step-forward']"
:title="$t('Video.Play Next Video')"
role="button"
tabindex="0"
@click="playNextVideo"
@keydown.enter.prevent="playNextVideo"
@keydown.space.prevent="playNextVideo"
/>
<font-awesome-icon
class="playlistIcon"
:class="{ playlistIconActive: pauseOnCurrentVideo }"
:icon="['fas', 'pause']"
:title="$t('Video.Pause on Current Video')"
role="button"
tabindex="0"
:aria-pressed="pauseOnCurrentVideo"
@click="togglePauseOnCurrentVideo"
@keydown.enter.prevent="togglePauseOnCurrentVideo"
@keydown.space.prevent="togglePauseOnCurrentVideo"
/>
</p>
<div
v-if="!isLoading"
ref="playlistItems"
class="playlistItems"
>
<ft-list-video-numbered
v-for="(item, index) in playlistItems"
:key="item.playlistItemId || item.videoId"
:ref="currentVideoIndexZeroBased === index ? 'currentVideoItem' : null"
class="playlistItem"
:data="item"
:playlist-id="playlistId"
:playlist-type="playlistType"
:playlist-index="reversePlaylist ? playlistItems.length - index - 1 : index"
:playlist-item-id="item.playlistItemId"
:playlist-reverse="reversePlaylist"
:playlist-shuffle="shuffleEnabled"
:playlist-loop="loopEnabled"
:video-index="index"
:is-current-video="currentVideoIndexZeroBased === index"
appearance="watchPlaylistItem"
:initial-visible-state="index < (currentVideoIndexZeroBased + 4) && index > (currentVideoIndexZeroBased - 4)"
@pause-player="pausePlayer"
/>
</div>
</div>
</ft-card>
</template>
<script src="./watch-video-playlist.js" />
<style scoped src="./watch-video-playlist.css" />