@mux/mux-player 0.1.0-beta.23 → 0.1.0-beta.26
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/CHANGELOG.md +36 -0
- package/README.md +38 -36
- package/coverage/lcov-report/index.html +31 -31
- package/coverage/lcov-report/src/dialog.ts.html +1 -1
- package/coverage/lcov-report/src/errors.ts.html +1 -1
- package/coverage/lcov-report/src/helpers.ts.html +30 -9
- package/coverage/lcov-report/src/html.ts.html +159 -9
- package/coverage/lcov-report/src/index.html +52 -52
- package/coverage/lcov-report/src/index.ts.html +156 -27
- package/coverage/lcov-report/src/logger.ts.html +1 -1
- package/coverage/lcov-report/src/media-chrome/dialog.ts.html +1 -1
- package/coverage/lcov-report/src/media-chrome/index.html +1 -1
- package/coverage/lcov-report/src/media-chrome/time-display.ts.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/airplay.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/captions-off.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/captions-on.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/cast-enter.svg.html +103 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/cast-exit.svg.html +106 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-enter.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-exit.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/index.html +33 -3
- package/coverage/lcov-report/src/media-theme-mux/icons/pause.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/pip-enter.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/pip-exit.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/play.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/seek-backward.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/seek-forward.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-high.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-low.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-medium.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-off.svg.html +1 -1
- package/coverage/lcov-report/src/media-theme-mux/icons.ts.html +18 -6
- package/coverage/lcov-report/src/media-theme-mux/index.html +26 -26
- package/coverage/lcov-report/src/media-theme-mux/media-theme-mux.ts.html +342 -177
- package/coverage/lcov-report/src/media-theme-mux/styles.css.html +117 -18
- package/coverage/lcov-report/src/styles.css.html +1 -1
- package/coverage/lcov-report/src/template.ts.html +128 -65
- package/coverage/lcov-report/src/utils.ts.html +1 -1
- package/coverage/lcov-report/src/video-api.ts.html +91 -13
- package/coverage/lcov.info +1595 -1273
- package/dist/index.cjs.js +503 -343
- package/dist/index.mjs +296 -228
- package/dist/mux-player.js +556 -396
- package/dist/mux-player.mjs +556 -396
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/helpers.d.ts +1 -0
- package/dist/types/html.d.ts +5 -0
- package/dist/types/index.d.ts +5 -3
- package/dist/types/media-theme-mux/icons.d.ts +2 -0
- package/dist/types/media-theme-mux/media-theme-mux.d.ts +32 -12
- package/dist/types/template.d.ts +0 -1
- package/dist/types/video-api.d.ts +4 -0
- package/dist/types-ts3.4/helpers.d.ts +1 -0
- package/dist/types-ts3.4/html.d.ts +5 -0
- package/dist/types-ts3.4/index.d.ts +4 -3
- package/dist/types-ts3.4/media-theme-mux/icons.d.ts +2 -0
- package/dist/types-ts3.4/media-theme-mux/media-theme-mux.d.ts +32 -12
- package/dist/types-ts3.4/template.d.ts +0 -1
- package/dist/types-ts3.4/video-api.d.ts +2 -0
- package/package.json +5 -5
- package/src/helpers.ts +7 -0
- package/src/html.ts +50 -0
- package/src/index.ts +58 -15
- package/src/media-theme-mux/icons/cast-enter.svg +6 -0
- package/src/media-theme-mux/icons/cast-exit.svg +7 -0
- package/src/media-theme-mux/icons.ts +4 -0
- package/src/media-theme-mux/media-theme-mux.ts +179 -124
- package/src/media-theme-mux/styles.css +47 -14
- package/src/template.ts +78 -57
- package/src/types.d.ts +3 -0
- package/src/video-api.ts +27 -1
- package/test/player.test.js +34 -0
- package/test/template.test.js +6 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'media-chrome';
|
|
1
|
+
import { MediaTheme } from 'media-chrome';
|
|
2
2
|
import { html, render } from '../html';
|
|
3
3
|
import '../media-chrome/time-display';
|
|
4
4
|
|
|
@@ -14,26 +14,88 @@ const MediaChromeSizes = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
type ThemeMuxTemplateProps = {
|
|
17
|
-
streamType: string;
|
|
17
|
+
streamType: string | null;
|
|
18
|
+
nohotkeys?: boolean;
|
|
18
19
|
audio: boolean;
|
|
19
|
-
playerSize: string;
|
|
20
|
+
playerSize: string | null;
|
|
20
21
|
defaultHiddenCaptions: boolean;
|
|
21
|
-
forwardSeekOffset:
|
|
22
|
-
backwardSeekOffset:
|
|
22
|
+
forwardSeekOffset: string | null;
|
|
23
|
+
backwardSeekOffset: string | null;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
export const parts = {
|
|
27
|
+
mediaChrome: 'layer media-layer poster-layer vertical-layer centered-layer',
|
|
28
|
+
centerPlay: 'center play button',
|
|
29
|
+
centerSeekBackward: 'center seek-backward button',
|
|
30
|
+
centerSeekForward: 'center seek-forward button',
|
|
31
|
+
play: 'play button',
|
|
32
|
+
seekBackward: 'seek-backward button',
|
|
33
|
+
seekForward: 'seek-forward button',
|
|
34
|
+
mute: 'mute button',
|
|
35
|
+
captions: 'captions button',
|
|
36
|
+
airplay: 'airplay button',
|
|
37
|
+
pip: 'pip button',
|
|
38
|
+
fullscreen: 'fullscreen button',
|
|
39
|
+
cast: 'cast button',
|
|
40
|
+
playbackRate: 'playbackrate button',
|
|
41
|
+
volumeRange: 'volume range',
|
|
42
|
+
timeRange: 'time range',
|
|
43
|
+
timeDisplay: 'time display',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default class MediaThemeMux extends MediaTheme {
|
|
47
|
+
static get observedAttributes() {
|
|
48
|
+
return [
|
|
49
|
+
'audio',
|
|
50
|
+
'nohotkeys',
|
|
51
|
+
'stream-type',
|
|
52
|
+
'player-size',
|
|
53
|
+
'default-hidden-captions',
|
|
54
|
+
'forward-seek-offset',
|
|
55
|
+
'backward-seek-offset',
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
attributeChangedCallback() {
|
|
60
|
+
this.render();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
const props = {
|
|
65
|
+
audio: this.hasAttribute('audio'),
|
|
66
|
+
nohotkeys: this.hasAttribute('nohotkeys'),
|
|
67
|
+
streamType: this.getAttribute('stream-type'),
|
|
68
|
+
playerSize: this.getAttribute('player-size'),
|
|
69
|
+
defaultHiddenCaptions: this.hasAttribute('default-hidden-captions'),
|
|
70
|
+
forwardSeekOffset: this.getAttribute('forward-seek-offset'),
|
|
71
|
+
backwardSeekOffset: this.getAttribute('backward-seek-offset'),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
render(
|
|
75
|
+
html`
|
|
76
|
+
<style>
|
|
77
|
+
${cssStr}
|
|
78
|
+
</style>
|
|
79
|
+
<media-controller
|
|
80
|
+
nohotkeys="${props.nohotkeys || false}"
|
|
81
|
+
audio="${props.audio || false}"
|
|
82
|
+
class="size-${props.playerSize}"
|
|
83
|
+
exportparts="${parts.mediaChrome.split(' ').join(', ')}"
|
|
84
|
+
>
|
|
85
|
+
<slot name="media" slot="media"></slot>
|
|
86
|
+
<media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
|
|
87
|
+
${ChromeRenderer(props)}
|
|
88
|
+
<slot></slot>
|
|
89
|
+
</media-controller>
|
|
90
|
+
`,
|
|
91
|
+
this.shadowRoot as Node
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!customElements.get('media-theme-mux')) {
|
|
97
|
+
customElements.define('media-theme-mux', MediaThemeMux);
|
|
98
|
+
}
|
|
37
99
|
|
|
38
100
|
const ChromeRenderer = (props: ThemeMuxTemplateProps) => {
|
|
39
101
|
const { streamType, playerSize, audio } = props;
|
|
@@ -41,7 +103,7 @@ const ChromeRenderer = (props: ThemeMuxTemplateProps) => {
|
|
|
41
103
|
switch (streamType) {
|
|
42
104
|
case StreamTypes.LIVE:
|
|
43
105
|
case StreamTypes.LL_LIVE: {
|
|
44
|
-
return AudioLiveChrome(
|
|
106
|
+
return AudioLiveChrome();
|
|
45
107
|
}
|
|
46
108
|
case StreamTypes.DVR:
|
|
47
109
|
case StreamTypes.LL_DVR: {
|
|
@@ -93,30 +155,32 @@ const ChromeRenderer = (props: ThemeMuxTemplateProps) => {
|
|
|
93
155
|
};
|
|
94
156
|
|
|
95
157
|
// prettier-ignore
|
|
96
|
-
const MediaPlayButton = () => html`
|
|
97
|
-
<media-play-button>
|
|
158
|
+
const MediaPlayButton = ({ part = parts.play } = {}) => html`
|
|
159
|
+
<media-play-button part="${part}">
|
|
98
160
|
${icons.Play()}
|
|
99
161
|
${icons.Pause()}
|
|
100
162
|
</media-play-button>
|
|
101
163
|
`;
|
|
102
164
|
|
|
103
165
|
// prettier-ignore
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
166
|
+
type SeekBackwardButtonProps = { backwardSeekOffset: string, part?: string };
|
|
167
|
+
const MediaSeekBackwardButton = ({ backwardSeekOffset, part = parts.seekBackward }: SeekBackwardButtonProps) => html`
|
|
168
|
+
<media-seek-backward-button seek-offset="${backwardSeekOffset}" part="${part}">
|
|
169
|
+
${icons.SeekBackward({ value: backwardSeekOffset })}
|
|
107
170
|
</media-seek-backward-button>
|
|
108
171
|
`;
|
|
109
172
|
|
|
110
173
|
// prettier-ignore
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
174
|
+
type SeekForwardButtonProps = { forwardSeekOffset: string, part?: string };
|
|
175
|
+
const MediaSeekForwardButton = ({ forwardSeekOffset, part = parts.seekForward }: SeekForwardButtonProps) => html`
|
|
176
|
+
<media-seek-forward-button seek-offset="${forwardSeekOffset}" part="${part}">
|
|
177
|
+
${icons.SeekForward({ value: forwardSeekOffset })}
|
|
114
178
|
</media-seek-forward-button>
|
|
115
179
|
`;
|
|
116
180
|
|
|
117
181
|
// prettier-ignore
|
|
118
182
|
const MediaMuteButton = () => html`
|
|
119
|
-
<media-mute-button>
|
|
183
|
+
<media-mute-button part="${parts.mute}">
|
|
120
184
|
${icons.VolumeHigh()}
|
|
121
185
|
${icons.VolumeMedium()}
|
|
122
186
|
${icons.VolumeLow()}
|
|
@@ -126,67 +190,100 @@ const MediaMuteButton = () => html`
|
|
|
126
190
|
|
|
127
191
|
// prettier-ignore
|
|
128
192
|
const MediaCaptionsButton = (props: ThemeMuxTemplateProps) => html`
|
|
129
|
-
<media-captions-button default-showing="${!props.defaultHiddenCaptions}" >
|
|
193
|
+
<media-captions-button default-showing="${!props.defaultHiddenCaptions}" part="${parts.captions}">
|
|
130
194
|
${icons.CaptionsOff()}
|
|
131
195
|
${icons.CaptionsOn()}
|
|
132
196
|
</media-captions-button>`;
|
|
133
197
|
|
|
134
198
|
// prettier-ignore
|
|
135
199
|
const MediaAirplayButton = () => html`
|
|
136
|
-
<media-airplay-button>
|
|
200
|
+
<media-airplay-button part="${parts.airplay}">
|
|
137
201
|
${icons.Airplay()}
|
|
138
202
|
</media-airplay-button>`;
|
|
139
203
|
|
|
140
204
|
// prettier-ignore
|
|
141
205
|
const MediaPipButton = () => html`
|
|
142
|
-
<media-pip-button>
|
|
206
|
+
<media-pip-button part="${parts.pip}">
|
|
143
207
|
${icons.PipEnter()}
|
|
144
208
|
${icons.PipExit()}
|
|
145
209
|
</media-pip-button>`;
|
|
146
210
|
|
|
147
211
|
// prettier-ignore
|
|
148
212
|
const MediaFullscreenButton = () => html`
|
|
149
|
-
<media-fullscreen-button>
|
|
213
|
+
<media-fullscreen-button part="${parts.fullscreen}">
|
|
150
214
|
${icons.FullscreenEnter()}
|
|
151
215
|
${icons.FullscreenExit()}
|
|
152
216
|
</media-fullscreen-button>`;
|
|
153
217
|
|
|
218
|
+
// prettier-ignore
|
|
219
|
+
const MediaCastButton = () => html`
|
|
220
|
+
<media-cast-button part="${parts.cast}">
|
|
221
|
+
${icons.CastEnter()}
|
|
222
|
+
${icons.CastExit()}
|
|
223
|
+
</media-cast-button>`;
|
|
224
|
+
|
|
225
|
+
// prettier-ignore
|
|
226
|
+
const MediaPlaybackRateButton = () => html`
|
|
227
|
+
<media-playback-rate-button part="${parts.playbackRate}">
|
|
228
|
+
</media-playback-rate-button>`;
|
|
229
|
+
|
|
230
|
+
// prettier-ignore
|
|
231
|
+
const MediaVolumeRange = () => html`
|
|
232
|
+
<media-volume-range part="${parts.volumeRange}">
|
|
233
|
+
</media-volume-range>`;
|
|
234
|
+
|
|
235
|
+
// prettier-ignore
|
|
236
|
+
const MediaTimeRange = () => html`
|
|
237
|
+
<media-time-range part="${parts.timeRange}">
|
|
238
|
+
</media-time-range>`;
|
|
239
|
+
|
|
240
|
+
// prettier-ignore
|
|
241
|
+
const TimeDisplay = () => html`
|
|
242
|
+
<mxp-time-display part="${parts.timeDisplay}">
|
|
243
|
+
</mxp-time-display>`;
|
|
244
|
+
|
|
245
|
+
// prettier-ignore
|
|
154
246
|
export const AudioVodChrome = (props: ThemeMuxTemplateProps) => html`
|
|
155
247
|
<media-control-bar>
|
|
156
|
-
${MediaPlayButton()}
|
|
157
|
-
|
|
158
|
-
|
|
248
|
+
${MediaPlayButton()}
|
|
249
|
+
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
|
|
250
|
+
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
|
|
251
|
+
${TimeDisplay()}
|
|
252
|
+
${MediaTimeRange()}
|
|
159
253
|
${MediaMuteButton()}
|
|
160
|
-
|
|
161
|
-
|
|
254
|
+
${MediaVolumeRange()}
|
|
255
|
+
${MediaPlaybackRateButton()}
|
|
162
256
|
${MediaAirplayButton()}
|
|
163
|
-
|
|
257
|
+
${MediaCastButton()}
|
|
164
258
|
</media-control-bar>
|
|
165
259
|
`;
|
|
166
260
|
|
|
261
|
+
// prettier-ignore
|
|
167
262
|
export const AudioDvrChrome = (props: ThemeMuxTemplateProps) => html`
|
|
168
263
|
<media-control-bar>
|
|
169
264
|
${MediaPlayButton()}
|
|
170
265
|
<slot name="seek-to-live-button"></slot>
|
|
171
|
-
${MediaSeekBackwardButton(props
|
|
172
|
-
|
|
173
|
-
|
|
266
|
+
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
|
|
267
|
+
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
|
|
268
|
+
${TimeDisplay()}
|
|
269
|
+
${MediaTimeRange()}
|
|
174
270
|
${MediaMuteButton()}
|
|
175
|
-
|
|
176
|
-
|
|
271
|
+
${MediaVolumeRange()}
|
|
272
|
+
${MediaPlaybackRateButton()}
|
|
177
273
|
${MediaAirplayButton()}
|
|
178
|
-
|
|
274
|
+
${MediaCastButton()}
|
|
179
275
|
</media-control-bar>
|
|
180
276
|
`;
|
|
181
277
|
|
|
182
|
-
|
|
278
|
+
// prettier-ignore
|
|
279
|
+
export const AudioLiveChrome = () => html`
|
|
183
280
|
<media-control-bar>
|
|
184
281
|
${MediaPlayButton()}
|
|
185
282
|
<slot name="seek-to-live-button"></slot>
|
|
186
283
|
${MediaMuteButton()}
|
|
187
|
-
|
|
284
|
+
${MediaVolumeRange()}
|
|
188
285
|
${MediaAirplayButton()}
|
|
189
|
-
|
|
286
|
+
${MediaCastButton()}
|
|
190
287
|
</media-control-bar>
|
|
191
288
|
`;
|
|
192
289
|
|
|
@@ -196,11 +293,11 @@ export const VodChromeExtraSmall = (props: ThemeMuxTemplateProps) => html`
|
|
|
196
293
|
${MediaCaptionsButton(props)}
|
|
197
294
|
<div class="mxp-spacer"></div>
|
|
198
295
|
${MediaAirplayButton()}
|
|
199
|
-
|
|
296
|
+
${MediaCastButton()}
|
|
200
297
|
${MediaPipButton()}
|
|
201
298
|
</media-control-bar>
|
|
202
299
|
<div slot="centered-chrome" class="mxp-center-controls">
|
|
203
|
-
${MediaPlayButton()}
|
|
300
|
+
${MediaPlayButton({ part: parts.centerPlay })}
|
|
204
301
|
</div>
|
|
205
302
|
<media-control-bar>
|
|
206
303
|
${MediaMuteButton()}
|
|
@@ -214,21 +311,21 @@ export const VodChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
|
214
311
|
<media-control-bar slot="top-chrome" style="justify-content: flex-end;">
|
|
215
312
|
${MediaCaptionsButton(props)}
|
|
216
313
|
${MediaAirplayButton()}
|
|
217
|
-
|
|
314
|
+
${MediaCastButton()}
|
|
218
315
|
${MediaPipButton()}
|
|
219
316
|
</media-control-bar>
|
|
220
317
|
<div slot="centered-chrome" class="mxp-center-controls">
|
|
221
|
-
${MediaSeekBackwardButton(props)}
|
|
222
|
-
${MediaPlayButton()}
|
|
223
|
-
${MediaSeekForwardButton(props)}
|
|
318
|
+
${MediaSeekBackwardButton({ ...props, part: parts.centerSeekBackward } as SeekBackwardButtonProps)}
|
|
319
|
+
${MediaPlayButton({ part: parts.centerPlay })}
|
|
320
|
+
${MediaSeekForwardButton({ ...props, part: parts.centerSeekForward } as SeekForwardButtonProps)}
|
|
224
321
|
</div>
|
|
225
|
-
|
|
322
|
+
${MediaTimeRange()}
|
|
226
323
|
<media-control-bar>
|
|
227
|
-
|
|
324
|
+
${TimeDisplay()}
|
|
228
325
|
${MediaMuteButton()}
|
|
229
|
-
|
|
326
|
+
${MediaVolumeRange()}
|
|
230
327
|
<div class="mxp-spacer"></div>
|
|
231
|
-
|
|
328
|
+
${MediaPlaybackRateButton()}
|
|
232
329
|
${MediaFullscreenButton()}
|
|
233
330
|
<div class="mxp-padding-2"></div>
|
|
234
331
|
</media-control-bar>
|
|
@@ -237,21 +334,21 @@ export const VodChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
|
237
334
|
// prettier-ignore
|
|
238
335
|
export const VodChromeLarge = (props: ThemeMuxTemplateProps) => html`
|
|
239
336
|
<div slot="centered-chrome" class="mxp-center-controls">
|
|
240
|
-
${MediaPlayButton()}
|
|
337
|
+
${MediaPlayButton({ part: parts.centerPlay })}
|
|
241
338
|
</div>
|
|
242
|
-
|
|
339
|
+
${MediaTimeRange()}
|
|
243
340
|
<media-control-bar>
|
|
244
341
|
${MediaPlayButton()}
|
|
245
|
-
${MediaSeekBackwardButton(props)}
|
|
246
|
-
${MediaSeekForwardButton(props)}
|
|
247
|
-
|
|
342
|
+
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
|
|
343
|
+
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
|
|
344
|
+
${TimeDisplay()}
|
|
248
345
|
${MediaMuteButton()}
|
|
249
|
-
|
|
346
|
+
${MediaVolumeRange()}
|
|
250
347
|
<div class="mxp-spacer"></div>
|
|
251
|
-
|
|
348
|
+
${MediaPlaybackRateButton()}
|
|
252
349
|
${MediaCaptionsButton(props)}
|
|
253
350
|
${MediaAirplayButton()}
|
|
254
|
-
|
|
351
|
+
${MediaCastButton()}
|
|
255
352
|
${MediaPipButton()}
|
|
256
353
|
${MediaFullscreenButton()}
|
|
257
354
|
<div class="mxp-padding-2"></div>
|
|
@@ -268,15 +365,15 @@ export const LiveChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
|
268
365
|
<div class="mxp-spacer"></div>
|
|
269
366
|
${MediaCaptionsButton(props)}
|
|
270
367
|
${MediaAirplayButton()}
|
|
271
|
-
|
|
368
|
+
${MediaCastButton()}
|
|
272
369
|
${MediaPipButton()}
|
|
273
370
|
</media-control-bar>
|
|
274
371
|
<div slot="centered-chrome" class="mxp-center-controls">
|
|
275
|
-
${MediaPlayButton()}
|
|
372
|
+
${MediaPlayButton({ part: parts.centerPlay })}
|
|
276
373
|
</div>
|
|
277
374
|
<media-control-bar>
|
|
278
375
|
${MediaMuteButton()}
|
|
279
|
-
|
|
376
|
+
${MediaVolumeRange()}
|
|
280
377
|
<div class="mxp-spacer"></div>
|
|
281
378
|
${MediaFullscreenButton()}
|
|
282
379
|
</media-control-bar>
|
|
@@ -288,15 +385,15 @@ export const LiveChromeLarge = (props: ThemeMuxTemplateProps) => html`
|
|
|
288
385
|
<slot name="seek-to-live-button"></slot>
|
|
289
386
|
</media-control-bar>
|
|
290
387
|
<div slot="centered-chrome" class="mxp-center-controls">
|
|
291
|
-
${MediaPlayButton()}
|
|
388
|
+
${MediaPlayButton({ part: parts.centerPlay })}
|
|
292
389
|
</div>
|
|
293
390
|
<media-control-bar>
|
|
294
391
|
${MediaMuteButton()}
|
|
295
|
-
|
|
392
|
+
${MediaVolumeRange()}
|
|
296
393
|
<div class="mxp-spacer"></div>
|
|
297
394
|
${MediaCaptionsButton(props)}
|
|
298
395
|
${MediaAirplayButton()}
|
|
299
|
-
|
|
396
|
+
${MediaCastButton()}
|
|
300
397
|
${MediaPipButton()}
|
|
301
398
|
${MediaFullscreenButton()}
|
|
302
399
|
</media-control-bar>
|
|
@@ -310,18 +407,18 @@ export const DvrChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
|
310
407
|
<media-control-bar slot="top-chrome" style="justify-content: flex-end;">
|
|
311
408
|
${MediaCaptionsButton(props)}
|
|
312
409
|
${MediaAirplayButton()}
|
|
313
|
-
|
|
410
|
+
${MediaCastButton()}
|
|
314
411
|
${MediaPipButton()}
|
|
315
412
|
</media-control-bar>
|
|
316
413
|
<div slot="centered-chrome" class="mxp-center-controls">
|
|
317
|
-
${MediaSeekBackwardButton(props)}
|
|
318
|
-
${MediaPlayButton()}
|
|
319
|
-
${MediaSeekForwardButton(props)}
|
|
414
|
+
${MediaSeekBackwardButton({ ...props, part: parts.centerSeekBackward } as SeekBackwardButtonProps)}
|
|
415
|
+
${MediaPlayButton({ part: parts.centerPlay })}
|
|
416
|
+
${MediaSeekForwardButton({ ...props, part: parts.centerSeekForward } as SeekForwardButtonProps)}
|
|
320
417
|
</div>
|
|
321
|
-
|
|
418
|
+
${MediaTimeRange()}
|
|
322
419
|
<media-control-bar>
|
|
323
420
|
${MediaMuteButton()}
|
|
324
|
-
|
|
421
|
+
${MediaVolumeRange()}
|
|
325
422
|
<slot name="seek-to-live-button"></slot>
|
|
326
423
|
<div class="mxp-spacer"></div>
|
|
327
424
|
${MediaFullscreenButton()}
|
|
@@ -332,64 +429,22 @@ export const DvrChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
|
332
429
|
// prettier-ignore
|
|
333
430
|
export const DvrChromeLarge = (props: ThemeMuxTemplateProps) => html`
|
|
334
431
|
<div slot="centered-chrome" class="mxp-center-controls">
|
|
335
|
-
${MediaPlayButton()}
|
|
432
|
+
${MediaPlayButton({ part: parts.centerPlay })}
|
|
336
433
|
</div>
|
|
337
|
-
|
|
434
|
+
${MediaTimeRange()}
|
|
338
435
|
<media-control-bar>
|
|
339
436
|
${MediaPlayButton()}
|
|
340
|
-
${MediaSeekBackwardButton(props)}
|
|
341
|
-
${MediaSeekForwardButton(props)}
|
|
437
|
+
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
|
|
438
|
+
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
|
|
342
439
|
${MediaMuteButton()}
|
|
343
|
-
|
|
440
|
+
${MediaVolumeRange()}
|
|
344
441
|
<slot name="seek-to-live-button"></slot>
|
|
345
442
|
<div class="mxp-spacer"></div>
|
|
346
443
|
${MediaCaptionsButton(props)}
|
|
347
444
|
${MediaAirplayButton()}
|
|
348
|
-
|
|
445
|
+
${MediaCastButton()}
|
|
349
446
|
${MediaPipButton()}
|
|
350
447
|
${MediaFullscreenButton()}
|
|
351
448
|
<div class="mxp-padding-2"></div>
|
|
352
449
|
</media-control-bar>
|
|
353
450
|
`;
|
|
354
|
-
|
|
355
|
-
function getProps(el: MediaThemeMux, state?: any): ThemeMuxTemplateProps {
|
|
356
|
-
return {
|
|
357
|
-
audio: el.hasAttribute('audio'),
|
|
358
|
-
streamType: el.getAttribute('stream-type'),
|
|
359
|
-
playerSize: el.getAttribute('player-size'),
|
|
360
|
-
defaultHiddenCaptions: el.hasAttribute('default-hidden-captions'),
|
|
361
|
-
forwardSeekOffset: el.getAttribute('forward-seek-offset'),
|
|
362
|
-
backwardSeekOffset: el.getAttribute('backward-seek-offset'),
|
|
363
|
-
...state,
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
class MediaThemeMux extends HTMLElement {
|
|
368
|
-
static get observedAttributes() {
|
|
369
|
-
return [
|
|
370
|
-
'audio',
|
|
371
|
-
'stream-type',
|
|
372
|
-
'player-size',
|
|
373
|
-
'default-hidden-captions',
|
|
374
|
-
'forward-seek-offset',
|
|
375
|
-
'backward-seek-offset',
|
|
376
|
-
];
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
constructor() {
|
|
380
|
-
super();
|
|
381
|
-
|
|
382
|
-
this.attachShadow({ mode: 'open' });
|
|
383
|
-
render(template(getProps(this)), this.shadowRoot as Node);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
attributeChangedCallback() {
|
|
387
|
-
render(template(getProps(this)), this.shadowRoot as Node);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (!customElements.get('media-theme-mux')) {
|
|
392
|
-
customElements.define('media-theme-mux', MediaThemeMux);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
export default MediaThemeMux;
|
|
@@ -3,20 +3,44 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
|
-
color: var(--primary-color);
|
|
7
|
-
|
|
8
|
-
--media-
|
|
9
|
-
--media-range-
|
|
6
|
+
--_primary-color: var(--primary-color, #fff);
|
|
7
|
+
|
|
8
|
+
--media-icon-color: var(--_primary-color);
|
|
9
|
+
--media-range-thumb-background: var(--_primary-color);
|
|
10
|
+
--media-range-bar-color: var(--_primary-color);
|
|
10
11
|
--media-control-background: var(--secondary-color);
|
|
11
12
|
--media-control-hover-background: var(--secondary-color);
|
|
12
|
-
--media-time-buffered-color: rgba(255, 255, 255, 0.
|
|
13
|
+
--media-time-buffered-color: rgba(255, 255, 255, 0.4);
|
|
13
14
|
--media-range-track-background: rgba(255, 255, 255, 0.5);
|
|
14
15
|
--media-range-track-border-radius: 3px;
|
|
16
|
+
--media-preview-thumbnail-border: 1px solid #fff;
|
|
17
|
+
--media-preview-thumbnail-border-radius: 2px;
|
|
18
|
+
--media-preview-time-margin: 5px 0 2px;
|
|
19
|
+
color: var(--_primary-color);
|
|
15
20
|
display: inline-block;
|
|
16
21
|
width: 100%;
|
|
17
22
|
height: 100%;
|
|
18
23
|
}
|
|
19
24
|
|
|
25
|
+
:host(.two-tone:not([audio])) {
|
|
26
|
+
--mux-time-range-padding: 0px; /* px is needed in calc() */
|
|
27
|
+
--media-preview-thumbnail-border: 0;
|
|
28
|
+
--media-preview-thumbnail-border-radius: 2px 2px 0 0;
|
|
29
|
+
--media-preview-time-border-radius: 0 0 2px 2px;
|
|
30
|
+
--media-preview-time-margin: 0 0 8px;
|
|
31
|
+
--media-preview-time-text-shadow: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([audio]) {
|
|
35
|
+
--media-preview-time-border-radius: 3px;
|
|
36
|
+
--media-preview-time-margin: 0 0 5px;
|
|
37
|
+
--media-preview-time-text-shadow: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host(.two-tone:not([audio])) media-time-range {
|
|
41
|
+
--media-range-track-border-radius: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
20
44
|
:host([audio]) ::slotted([slot='media']) {
|
|
21
45
|
height: 0px;
|
|
22
46
|
}
|
|
@@ -54,13 +78,26 @@ media-controller {
|
|
|
54
78
|
height: 100%;
|
|
55
79
|
}
|
|
56
80
|
|
|
81
|
+
:host media-time-range {
|
|
82
|
+
color: var(--_primary-color);
|
|
83
|
+
}
|
|
84
|
+
|
|
57
85
|
:host(:not([audio])) media-time-range {
|
|
58
|
-
padding: var(--mux-time-range-padding,
|
|
59
|
-
|
|
86
|
+
--media-range-padding-left: var(--mux-time-range-padding, 10px);
|
|
87
|
+
--media-range-padding-right: var(--mux-time-range-padding, 10px);
|
|
60
88
|
width: 100%;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
89
|
+
z-index: 10;
|
|
90
|
+
height: 10px;
|
|
91
|
+
bottom: -2px;
|
|
92
|
+
background: linear-gradient(
|
|
93
|
+
180deg,
|
|
94
|
+
transparent,
|
|
95
|
+
transparent 3px,
|
|
96
|
+
var(--media-control-background) 3px,
|
|
97
|
+
var(--media-control-background) 8px,
|
|
98
|
+
transparent 8px,
|
|
99
|
+
transparent
|
|
100
|
+
);
|
|
64
101
|
}
|
|
65
102
|
|
|
66
103
|
media-control-bar {
|
|
@@ -71,10 +108,6 @@ media-control-bar :is([role='button'], [role='switch'], button) {
|
|
|
71
108
|
height: 44px;
|
|
72
109
|
}
|
|
73
110
|
|
|
74
|
-
media-cast-button {
|
|
75
|
-
width: 40px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
111
|
.size-extra-small media-control-bar [role='button'],
|
|
79
112
|
.size-extra-small media-control-bar [role='switch'] {
|
|
80
113
|
height: auto;
|