@outbook/webcomponents-player 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_lib/controls/index.js +1 -11
- package/_lib/get-cover.js +20 -2
- package/_lib/playlist/index.js +2 -2
- package/_lib/setup-media-session.js +5 -8
- package/_style/player.style.js +454 -2
- package/package.json +7 -7
- package/player.js +5 -3
package/_lib/controls/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
stop
|
|
9
9
|
} from '@outbook/icons';
|
|
10
10
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
|
-
import { isEventClick, isKeyEnterOrKeySpace } from '@outbook/a11y';
|
|
12
11
|
import { classMap } from 'lit/directives/class-map.js';
|
|
13
12
|
|
|
14
13
|
export function Controls({ props, handleAudio, literals = {} }) {
|
|
@@ -53,14 +52,6 @@ export function Controls({ props, handleAudio, literals = {} }) {
|
|
|
53
52
|
}
|
|
54
53
|
];
|
|
55
54
|
|
|
56
|
-
function handleControl(action) {
|
|
57
|
-
return ev => {
|
|
58
|
-
if (isEventClick(ev) || isKeyEnterOrKeySpace(ev)) {
|
|
59
|
-
action();
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
55
|
return html`
|
|
65
56
|
<div class="player-controls">
|
|
66
57
|
<ul class="player-controls__items">
|
|
@@ -78,8 +69,7 @@ export function Controls({ props, handleAudio, literals = {} }) {
|
|
|
78
69
|
item.isDisabled ? 'disabled' : undefined
|
|
79
70
|
)}"
|
|
80
71
|
data-test-id="player-button-${item.id}"
|
|
81
|
-
@click="${
|
|
82
|
-
@keydown="${handleControl(item.action)}"
|
|
72
|
+
@click="${item.action}"
|
|
83
73
|
>
|
|
84
74
|
${TypeIcon({
|
|
85
75
|
icon: item.icon,
|
package/_lib/get-cover.js
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
export function getCover(data) {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
if (!data || typeof data !== 'object') {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const { path = '', extension, name } = data;
|
|
7
|
+
if (typeof name !== 'string' || !name.trim()) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const normalizedName = name.trim();
|
|
12
|
+
const fileName =
|
|
13
|
+
typeof extension === 'string' && extension.trim()
|
|
14
|
+
? `${normalizedName}.${extension.trim().replace(/^\./, '')}`
|
|
15
|
+
: normalizedName;
|
|
16
|
+
const normalizedPath =
|
|
17
|
+
typeof path === 'string' && path !== '/' ? path.replace(/\/+$/, '') : path;
|
|
18
|
+
|
|
19
|
+
return normalizedPath
|
|
20
|
+
? `${normalizedPath}${normalizedPath === '/' ? '' : '/'}${fileName}`
|
|
21
|
+
: fileName;
|
|
4
22
|
}
|
package/_lib/playlist/index.js
CHANGED
|
@@ -20,11 +20,11 @@ export const Playlist = virtual(
|
|
|
20
20
|
}) => {
|
|
21
21
|
const { showArtwork, showTrackNumber, showFileExtension } = list;
|
|
22
22
|
function handleButton(index) {
|
|
23
|
-
return ev => {
|
|
23
|
+
return (ev) => {
|
|
24
24
|
if (isEventClick(ev) || isKeyEnterOrKeySpace(ev)) {
|
|
25
25
|
handleAudio.setTrack({ index, fromControls: false });
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
return html`
|
|
30
30
|
<div class="player-playlist" id="${listId}">
|
|
@@ -44,18 +44,15 @@ export function setupMediaSession({ owner, index, playlist, handleAudio }) {
|
|
|
44
44
|
|
|
45
45
|
mediaSessionOwner = owner;
|
|
46
46
|
const metadata = playlist[index];
|
|
47
|
-
const
|
|
47
|
+
const coverUrl = getCover(metadata.cover);
|
|
48
|
+
const extension = metadata.cover?.extension?.toLowerCase().replace(/^\./, '');
|
|
49
|
+
const subtype = { jpg: 'jpeg', svg: 'svg+xml' }[extension] || extension;
|
|
50
|
+
const type = subtype ? `image/${subtype}` : undefined;
|
|
48
51
|
mediaSession.metadata = new MediaMetadata({
|
|
49
52
|
title: metadata.title,
|
|
50
53
|
artist: metadata.artist,
|
|
51
54
|
album: metadata.album,
|
|
52
|
-
artwork: [
|
|
53
|
-
return {
|
|
54
|
-
src: metadata.cover ? getCover(metadata.cover) : null,
|
|
55
|
-
sizes: `${size}x${size}`,
|
|
56
|
-
type
|
|
57
|
-
};
|
|
58
|
-
})
|
|
55
|
+
artwork: coverUrl ? [{ src: coverUrl, ...(type ? { type } : {}) }] : []
|
|
59
56
|
});
|
|
60
57
|
mediaSession.setActionHandler(
|
|
61
58
|
'nexttrack',
|
package/_style/player.style.js
CHANGED
|
@@ -1,4 +1,456 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* oxlint-disable */
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
|
|
4
|
-
export default css`.skeleton-loader
|
|
4
|
+
export default css`.skeleton-loader {
|
|
5
|
+
--pulse-bg-start: blue;
|
|
6
|
+
--pulse-bg-end: red;
|
|
7
|
+
}
|
|
8
|
+
@keyframes colorPulse {
|
|
9
|
+
from {
|
|
10
|
+
background-color: var(--pulse-bg-start);
|
|
11
|
+
}
|
|
12
|
+
to {
|
|
13
|
+
background-color: var(--pulse-bg-end);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
.skeleton-loader {
|
|
17
|
+
background-color: var(--pulse-bg-start);
|
|
18
|
+
animation: colorPulse 3.2s ease infinite alternate-reverse;
|
|
19
|
+
opacity: 0.3;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host {
|
|
23
|
+
display: block;
|
|
24
|
+
color-scheme: inherit;
|
|
25
|
+
width: 100%;
|
|
26
|
+
--_main-height: var(--outbook-player--height, 32rem);
|
|
27
|
+
--_accent-0: var(--outbook-player--color-accent-0, oklch(100% 0 0deg));
|
|
28
|
+
--_accent-50: var(--outbook-player--color-accent-50, oklch(98.5% 0 0deg));
|
|
29
|
+
--_accent-100: var(
|
|
30
|
+
--outbook-player--color-accent-100,
|
|
31
|
+
oklch(97% 0 0deg)
|
|
32
|
+
);
|
|
33
|
+
--_accent-200: var(
|
|
34
|
+
--outbook-player--color-accent-200,
|
|
35
|
+
oklch(92.2% 0 0deg)
|
|
36
|
+
);
|
|
37
|
+
--_accent-300: var(
|
|
38
|
+
--outbook-player--color-accent-300,
|
|
39
|
+
oklch(87% 0 0deg)
|
|
40
|
+
);
|
|
41
|
+
--_accent-400: var(
|
|
42
|
+
--outbook-player--color-accent-400,
|
|
43
|
+
oklch(70.8% 0 0deg)
|
|
44
|
+
);
|
|
45
|
+
--_accent-500: var(
|
|
46
|
+
--outbook-player--color-accent-500,
|
|
47
|
+
oklch(55.6% 0 0deg)
|
|
48
|
+
);
|
|
49
|
+
--_accent-600: var(
|
|
50
|
+
--outbook-player--color-accent-600,
|
|
51
|
+
oklch(43.9% 0 0deg)
|
|
52
|
+
);
|
|
53
|
+
--_accent-700: var(
|
|
54
|
+
--outbook-player--color-accent-700,
|
|
55
|
+
oklch(37.1% 0 0deg)
|
|
56
|
+
);
|
|
57
|
+
--_accent-800: var(
|
|
58
|
+
--outbook-player--color-accent-800,
|
|
59
|
+
oklch(26.9% 0 0deg)
|
|
60
|
+
);
|
|
61
|
+
--_accent-900: var(
|
|
62
|
+
--outbook-player--color-accent-900,
|
|
63
|
+
oklch(20.5% 0 0deg)
|
|
64
|
+
);
|
|
65
|
+
--_accent-950: var(
|
|
66
|
+
--outbook-player--color-accent-950,
|
|
67
|
+
oklch(14.5% 0 0deg)
|
|
68
|
+
);
|
|
69
|
+
--_accent-1000: var(--outbook-player--color-accent-1000, oklch(0% 0 0deg));
|
|
70
|
+
--pulse-bg-start: light-dark(var(--_accent-100), var(--_accent-600));
|
|
71
|
+
--pulse-bg-end: light-dark(var(--_accent-600), var(--_accent-500));
|
|
72
|
+
--outbook-badge-file-extension--border-color: light-dark(
|
|
73
|
+
oklch(37.1% 0 0deg),
|
|
74
|
+
oklch(87% 0 0deg)
|
|
75
|
+
);
|
|
76
|
+
--outbook-badge-file-extension--text-color: light-dark(
|
|
77
|
+
oklch(14.5% 0 0deg),
|
|
78
|
+
oklch(100% 0 0deg)
|
|
79
|
+
);
|
|
80
|
+
--outbook-player-artwork--background-color: light-dark(
|
|
81
|
+
var(--_accent-200),
|
|
82
|
+
var(--_accent-700)
|
|
83
|
+
);
|
|
84
|
+
--outbook-player-artwork--text-color: light-dark(
|
|
85
|
+
var(--_accent-900),
|
|
86
|
+
var(--_accent-50)
|
|
87
|
+
);
|
|
88
|
+
--outbook-player-artwork--crystal-background: light-dark(
|
|
89
|
+
var(--_accent-100),
|
|
90
|
+
var(--_accent-900)
|
|
91
|
+
);
|
|
92
|
+
--outbook-player-artwork--crystal-border: light-dark(
|
|
93
|
+
var(--_accent-200),
|
|
94
|
+
var(--_accent-600)
|
|
95
|
+
);
|
|
96
|
+
--outbook-scrollable--indicator-color: light-dark(
|
|
97
|
+
var(--_accent-900),
|
|
98
|
+
var(--_accent-200)
|
|
99
|
+
);
|
|
100
|
+
--outbook-player-timeline--background: light-dark(
|
|
101
|
+
var(--_accent-200),
|
|
102
|
+
var(--_accent-800)
|
|
103
|
+
);
|
|
104
|
+
--outbook-player-timeline--background-completed: light-dark(
|
|
105
|
+
var(--_accent-800),
|
|
106
|
+
var(--_accent-200)
|
|
107
|
+
);
|
|
108
|
+
--outbook-player-timeline--chapter--mark-color: light-dark(
|
|
109
|
+
oklch(14.5% 0 0deg),
|
|
110
|
+
oklch(98.5% 0 0deg)
|
|
111
|
+
);
|
|
112
|
+
--outbook-player-timeline--chapter-played-mark-color: light-dark(
|
|
113
|
+
oklch(98.5% 0 0deg),
|
|
114
|
+
oklch(14.5% 0 0deg)
|
|
115
|
+
);
|
|
116
|
+
--_text-color: light-dark(oklch(20.5% 0 0deg), oklch(100% 0 0deg));
|
|
117
|
+
--_background-color: light-dark(
|
|
118
|
+
oklch(98.5% 0 0deg),
|
|
119
|
+
oklch(20.5% 0 0deg)
|
|
120
|
+
);
|
|
121
|
+
--_separator-color: light-dark(
|
|
122
|
+
oklch(92.2% 0 0deg),
|
|
123
|
+
oklch(43.9% 0 0deg)
|
|
124
|
+
);
|
|
125
|
+
--_link-color: light-dark(var(--_accent-700), var(--_accent-200));
|
|
126
|
+
--_link-color-hover: light-dark(var(--_accent-500), var(--_accent-50));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
* {
|
|
130
|
+
box-sizing: border-box;
|
|
131
|
+
padding: 0;
|
|
132
|
+
margin: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
ul,
|
|
136
|
+
ol,
|
|
137
|
+
li {
|
|
138
|
+
list-style: none;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
a,
|
|
142
|
+
button,
|
|
143
|
+
[role=button],
|
|
144
|
+
[role=link] {
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
}
|
|
147
|
+
a[disabled],
|
|
148
|
+
button[disabled],
|
|
149
|
+
[role=button][disabled],
|
|
150
|
+
[role=link][disabled] {
|
|
151
|
+
cursor: default;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.player {
|
|
155
|
+
container-name: player;
|
|
156
|
+
container-type: inline-size;
|
|
157
|
+
height: var(--_main-height);
|
|
158
|
+
background-color: var(--_background-color);
|
|
159
|
+
padding: 0.25rem;
|
|
160
|
+
position: relative;
|
|
161
|
+
}
|
|
162
|
+
.player::after, .player::before {
|
|
163
|
+
content: "";
|
|
164
|
+
height: 100%;
|
|
165
|
+
width: 100%;
|
|
166
|
+
position: absolute;
|
|
167
|
+
left: 0;
|
|
168
|
+
top: 0;
|
|
169
|
+
}
|
|
170
|
+
.player.has-gradient::after {
|
|
171
|
+
opacity: 0.65;
|
|
172
|
+
background-color: var(--_background-color);
|
|
173
|
+
}
|
|
174
|
+
.player::before {
|
|
175
|
+
opacity: 0.45;
|
|
176
|
+
background: linear-gradient(145deg, var(--_accent-400) 0%, var(--_accent-500) 25%, var(--_accent-600) 50%, var(--_accent-700) 75%, var(--_accent-800) 100%);
|
|
177
|
+
}
|
|
178
|
+
.player.has-gradient::before {
|
|
179
|
+
opacity: 1;
|
|
180
|
+
background: linear-gradient(145deg, var(--player--main-color-0) 0%, var(--player--main-color-1) 25%, var(--player--main-color-2) 50%, var(--player--main-color-3) 75%, var(--player--main-color-4) 100%);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@container player (width < 768px) {
|
|
184
|
+
.player__inner {
|
|
185
|
+
--player--flex-direction: column;
|
|
186
|
+
--_secondary-block-width: unset;
|
|
187
|
+
--_secondary-block-min-width: unset;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
@container player (width >= 768px) {
|
|
191
|
+
.player__inner {
|
|
192
|
+
--player--flex-direction: row;
|
|
193
|
+
--_secondary-block-width: 25%;
|
|
194
|
+
--_secondary-block-min-width: 20rem;
|
|
195
|
+
}
|
|
196
|
+
.playlist-align-left .player__inner {
|
|
197
|
+
--player--flex-direction: row-reverse;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
.player__inner {
|
|
201
|
+
display: flex;
|
|
202
|
+
flex-direction: column;
|
|
203
|
+
height: 100%;
|
|
204
|
+
color: var(--_text-color);
|
|
205
|
+
position: relative;
|
|
206
|
+
z-index: 2;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.player__body {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: var(--player--flex-direction);
|
|
212
|
+
flex: 1 0 0;
|
|
213
|
+
overflow: hidden;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.player__playlist {
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
padding: 0 0 0 0.5rem;
|
|
219
|
+
display: flex;
|
|
220
|
+
flex: 1 0 0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.player__track-info {
|
|
224
|
+
width: var(--_secondary-block-width);
|
|
225
|
+
min-width: var(--_secondary-block-min-width);
|
|
226
|
+
padding: 0.5rem;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.player__controls {
|
|
230
|
+
display: flex;
|
|
231
|
+
justify-content: center;
|
|
232
|
+
margin-top: -1rem;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.player__controls,
|
|
236
|
+
.player__timeline {
|
|
237
|
+
position: relative;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.player__timeline {
|
|
241
|
+
padding: 0 0.5rem;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.player-controls {
|
|
245
|
+
--_controls-color: light-dark(var(--_accent-950), var(--_accent-100));
|
|
246
|
+
--_controls-size: 3rem;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@container player (width >= 768px) {
|
|
250
|
+
.player-controls {
|
|
251
|
+
--_controls-size: 3.5rem;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
@container player (width >= 1024px) {
|
|
255
|
+
.player-controls {
|
|
256
|
+
--_controls-size: 4rem;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
.player-controls,
|
|
260
|
+
.player-controls__items {
|
|
261
|
+
width: auto;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.player-controls__items {
|
|
265
|
+
display: flex;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.player-controls__button {
|
|
269
|
+
background: transparent;
|
|
270
|
+
border: 0;
|
|
271
|
+
color: var(--_controls-color);
|
|
272
|
+
}
|
|
273
|
+
.player-controls__button:focus-visible {
|
|
274
|
+
outline: var(--outbook-outline--color, light-dark(oklch(48.8% 0.243 264.376deg), oklch(88.2% 0.059 254.128deg))) solid 2px;
|
|
275
|
+
outline-offset: -4px;
|
|
276
|
+
}
|
|
277
|
+
.player-controls__button.is-disabled {
|
|
278
|
+
opacity: 0.4;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.player-controls__icon {
|
|
282
|
+
width: var(--_controls-size);
|
|
283
|
+
height: var(--_controls-size);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.player-playlist {
|
|
287
|
+
--_playlist-font-weight: normal;
|
|
288
|
+
--_playlist-font-size: 0.75rem;
|
|
289
|
+
--_playlist-font-size-small: 0.625rem;
|
|
290
|
+
--_playlist-item-background-color: transparent;
|
|
291
|
+
--_playlist-item-image-size: 3rem;
|
|
292
|
+
}
|
|
293
|
+
.player-playlist .is-playing {
|
|
294
|
+
--_playlist-font-weight: 600;
|
|
295
|
+
--_playlist-item-background-color: var(--_accent-200);
|
|
296
|
+
}
|
|
297
|
+
.ambient-dark .player-playlist .is-playing {
|
|
298
|
+
--_playlist-item-background-color: var(--_accent-700);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@container player (width >= 768px) {
|
|
302
|
+
.player-playlist {
|
|
303
|
+
--_playlist-font-size: 0.875rem;
|
|
304
|
+
--_playlist-font-size-small: 0.75rem;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
@container player (width >= 1024px) {
|
|
308
|
+
.player-playlist {
|
|
309
|
+
--_playlist-font-size: 1rem;
|
|
310
|
+
--_playlist-font-size-small: 0.875rem;
|
|
311
|
+
--_playlist-item-image-size: 4rem;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
.player-playlist .track-text__item {
|
|
315
|
+
font-weight: var(--_playlist-font-weight);
|
|
316
|
+
font-size: var(--_playlist-font-size);
|
|
317
|
+
line-height: 150%;
|
|
318
|
+
}
|
|
319
|
+
.player-playlist .track-text__item.size-small {
|
|
320
|
+
font-size: var(--_playlist-font-size-small);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.player-playlist__items {
|
|
324
|
+
padding: 0;
|
|
325
|
+
position: relative;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.player-playlist__item {
|
|
329
|
+
position: relative;
|
|
330
|
+
border-bottom: 1px solid var(--_separator-color);
|
|
331
|
+
}
|
|
332
|
+
.player-playlist__item.is-playing:before {
|
|
333
|
+
content: "";
|
|
334
|
+
position: absolute;
|
|
335
|
+
top: 0;
|
|
336
|
+
left: 0;
|
|
337
|
+
width: 100%;
|
|
338
|
+
height: 100%;
|
|
339
|
+
opacity: 0.45;
|
|
340
|
+
}
|
|
341
|
+
@keyframes colorPulse {
|
|
342
|
+
from {
|
|
343
|
+
background-color: var(--pulse-bg-start);
|
|
344
|
+
}
|
|
345
|
+
to {
|
|
346
|
+
background-color: var(--pulse-bg-end);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
.player-playlist__item.is-playing:before {
|
|
350
|
+
background-color: var(--pulse-bg-start);
|
|
351
|
+
animation: colorPulse 3.2s ease infinite alternate-reverse;
|
|
352
|
+
opacity: 0.3;
|
|
353
|
+
}
|
|
354
|
+
.player-playlist__item:last-child {
|
|
355
|
+
border-bottom: 0;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.player-playlist__item-button {
|
|
359
|
+
display: flex;
|
|
360
|
+
width: 100%;
|
|
361
|
+
border: 0;
|
|
362
|
+
padding: 0.5rem;
|
|
363
|
+
position: relative;
|
|
364
|
+
align-items: center;
|
|
365
|
+
color: inherit;
|
|
366
|
+
background: transparent;
|
|
367
|
+
font: inherit;
|
|
368
|
+
text-align: inherit;
|
|
369
|
+
cursor: pointer;
|
|
370
|
+
}
|
|
371
|
+
.player-playlist__item-button:focus-visible {
|
|
372
|
+
outline: var(--outbook-outline--color, light-dark(oklch(48.8% 0.243 264.376deg), oklch(88.2% 0.059 254.128deg))) solid 2px;
|
|
373
|
+
outline-offset: -4px;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.player-playlist__item-group,
|
|
377
|
+
.player-playlist__item-block {
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: center;
|
|
380
|
+
margin-left: 1rem;
|
|
381
|
+
height: var(--_playlist-item-image-size);
|
|
382
|
+
}
|
|
383
|
+
.player-playlist__item-group:first-child,
|
|
384
|
+
.player-playlist__item-block:first-child {
|
|
385
|
+
margin-left: 0;
|
|
386
|
+
}
|
|
387
|
+
.player-playlist__item-group.is-last-right,
|
|
388
|
+
.player-playlist__item-block.is-last-right {
|
|
389
|
+
margin-left: auto;
|
|
390
|
+
padding-left: 0.5rem;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.player-playlist__item-image {
|
|
394
|
+
width: var(--_playlist-item-image-size);
|
|
395
|
+
height: var(--_playlist-item-image-size);
|
|
396
|
+
flex-shrink: 0;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.player-playlist__item-playing-icon {
|
|
400
|
+
width: 1rem;
|
|
401
|
+
height: 1rem;
|
|
402
|
+
display: flex;
|
|
403
|
+
align-items: center;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.player-playlist__item-playing-icon-inner {
|
|
407
|
+
width: 100%;
|
|
408
|
+
aspect-ratio: 1/1;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.track-info {
|
|
412
|
+
--track-info--flex-direction: row;
|
|
413
|
+
--track-info--image-width: 4rem;
|
|
414
|
+
--track-info--image-separation-horizontal: 1rem;
|
|
415
|
+
--track-info--image-separation-vertical: 0;
|
|
416
|
+
--track-info--height: 4rem;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
@container player (width >= 768px) {
|
|
420
|
+
.track-info {
|
|
421
|
+
--track-info--flex-direction: column;
|
|
422
|
+
--track-info--image-width: 100%;
|
|
423
|
+
--track-info--image-separation-horizontal: 0;
|
|
424
|
+
--track-info--image-separation-vertical: 1rem;
|
|
425
|
+
--track-info--height: auto;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
.track-info__inner {
|
|
429
|
+
display: flex;
|
|
430
|
+
flex-direction: var(--track-info--flex-direction);
|
|
431
|
+
height: var(--track-info--height);
|
|
432
|
+
}
|
|
433
|
+
.track-info__inner .track-text__item {
|
|
434
|
+
font-size: 1rem;
|
|
435
|
+
line-height: 150%;
|
|
436
|
+
}
|
|
437
|
+
.track-info__inner .track-text__item.size-small {
|
|
438
|
+
font-size: 0.75rem;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.track-info__image {
|
|
442
|
+
width: var(--track-info--image-width);
|
|
443
|
+
flex-shrink: 0;
|
|
444
|
+
display: flex;
|
|
445
|
+
align-items: center;
|
|
446
|
+
margin-right: var(--track-info--image-separation-horizontal);
|
|
447
|
+
margin-bottom: var(--track-info--image-separation-vertical);
|
|
448
|
+
}
|
|
449
|
+
.track-info__image > * {
|
|
450
|
+
width: 100%;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.track-info__data {
|
|
454
|
+
display: flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outbook/webcomponents-player",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"main": "player.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"description": "Web component media player (formerly mythical-player)",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@outbook/a11y": ">=1.
|
|
31
|
+
"@outbook/a11y": ">=1.3.0",
|
|
32
32
|
"color.js": "1.2.0",
|
|
33
33
|
"custom-event-conjurer": "1.0.0",
|
|
34
34
|
"@outbook/format-time": "1.0.5",
|
|
35
|
-
"@outbook/webcomponents-scrollable": ">=1.0
|
|
36
|
-
"@outbook/webcomponents-type-icon": ">=1.1.
|
|
37
|
-
"@outbook/webcomponents-badge-file-extension": ">=1.
|
|
35
|
+
"@outbook/webcomponents-scrollable": ">=1.1.0",
|
|
36
|
+
"@outbook/webcomponents-type-icon": ">=1.1.5",
|
|
37
|
+
"@outbook/webcomponents-badge-file-extension": ">=1.3.0",
|
|
38
38
|
"@outbook/webcomponents-player-artwork": ">=1.1.3",
|
|
39
|
-
"@outbook/webcomponents-player-timeline": ">=1.0.
|
|
40
|
-
"@outbook/icons": ">=1.3.
|
|
39
|
+
"@outbook/webcomponents-player-timeline": ">=1.0.8",
|
|
40
|
+
"@outbook/icons": ">=1.3.2",
|
|
41
41
|
"@outbook/webcomponents-player-audio-decoy": ">=1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
package/player.js
CHANGED
|
@@ -59,7 +59,7 @@ function ComponentPlayer(element) {
|
|
|
59
59
|
const [indexSelected, setIndexSelected] = useState(null);
|
|
60
60
|
const [isPlaying, setIsPlaying] = useState(false);
|
|
61
61
|
const [totalTime, setTotalTime] = useState(0);
|
|
62
|
-
const [currentTime, setCurrentTime] = useState(0);
|
|
62
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
63
63
|
const [prominentColors, setProminentColors] = useState('');
|
|
64
64
|
const [hasProminentColors, setHasProminentColors] = useState(false);
|
|
65
65
|
const [coverUrl, setCoverUrl] = useState(null);
|
|
@@ -326,7 +326,7 @@ function ComponentPlayer(element) {
|
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
setTotalTime(0);
|
|
329
|
-
setCurrentTime(0);
|
|
329
|
+
setCurrentTime(0);
|
|
330
330
|
setHasProminentColors(false);
|
|
331
331
|
setIsPlaying(false);
|
|
332
332
|
clearMediaSession({ owner: mediaSessionOwner.current });
|
|
@@ -453,7 +453,9 @@ function ComponentPlayer(element) {
|
|
|
453
453
|
<div class="player__timeline" @reposition="${handleReposition}">
|
|
454
454
|
${PlayerTimeline({
|
|
455
455
|
duration: totalTime,
|
|
456
|
-
currentTime
|
|
456
|
+
currentTime,
|
|
457
|
+
currentItem: playlist[indexSelected],
|
|
458
|
+
lang: currentLang
|
|
457
459
|
})}
|
|
458
460
|
</div>
|
|
459
461
|
<div class="player__controls">
|