@mux/mux-player 0.1.0-beta.21
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 +281 -0
- package/LICENSE +9 -0
- package/README.md +231 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/dialog.ts.html +247 -0
- package/coverage/lcov-report/src/errors.ts.html +574 -0
- package/coverage/lcov-report/src/helpers.ts.html +478 -0
- package/coverage/lcov-report/src/html.ts.html +580 -0
- package/coverage/lcov-report/src/index.html +251 -0
- package/coverage/lcov-report/src/index.ts.html +2941 -0
- package/coverage/lcov-report/src/logger.ts.html +163 -0
- package/coverage/lcov-report/src/media-chrome/dialog.ts.html +661 -0
- package/coverage/lcov-report/src/media-chrome/index.html +131 -0
- package/coverage/lcov-report/src/media-chrome/time-display.ts.html +295 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/airplay.svg.html +109 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/captions-off.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/captions-on.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-enter.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-exit.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/index.html +326 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/pause.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/pip-enter.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/pip-exit.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/play.svg.html +100 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/seek-backward.svg.html +124 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/seek-forward.svg.html +124 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-high.svg.html +103 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-low.svg.html +103 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-medium.svg.html +103 -0
- package/coverage/lcov-report/src/media-theme-mux/icons/volume-off.svg.html +103 -0
- package/coverage/lcov-report/src/media-theme-mux/icons.ts.html +184 -0
- package/coverage/lcov-report/src/media-theme-mux/index.html +146 -0
- package/coverage/lcov-report/src/media-theme-mux/media-theme-mux.ts.html +1279 -0
- package/coverage/lcov-report/src/media-theme-mux/styles.css.html +586 -0
- package/coverage/lcov-report/src/styles.css.html +211 -0
- package/coverage/lcov-report/src/template.ts.html +463 -0
- package/coverage/lcov-report/src/utils.ts.html +385 -0
- package/coverage/lcov-report/src/video-api.ts.html +979 -0
- package/coverage/lcov.info +4058 -0
- package/dist/index.cjs.js +1432 -0
- package/dist/index.mjs +709 -0
- package/dist/mux-player.js +1478 -0
- package/dist/mux-player.mjs +1478 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/dialog.d.ts +6 -0
- package/dist/types/errors.d.ts +6 -0
- package/dist/types/helpers.d.ts +26 -0
- package/dist/types/html.d.ts +18 -0
- package/dist/types/index.d.ts +199 -0
- package/dist/types/logger.d.ts +5 -0
- package/dist/types/media-chrome/dialog.d.ts +12 -0
- package/dist/types/media-chrome/time-display.d.ts +9 -0
- package/dist/types/media-theme-mux/icons.d.ts +15 -0
- package/dist/types/media-theme-mux/media-theme-mux.d.ts +29 -0
- package/dist/types/template.d.ts +5 -0
- package/dist/types/utils.d.ts +10 -0
- package/dist/types/video-api.d.ts +64 -0
- package/dist/types-ts3.4/dialog.d.ts +6 -0
- package/dist/types-ts3.4/errors.d.ts +6 -0
- package/dist/types-ts3.4/helpers.d.ts +26 -0
- package/dist/types-ts3.4/html.d.ts +18 -0
- package/dist/types-ts3.4/index.d.ts +180 -0
- package/dist/types-ts3.4/logger.d.ts +5 -0
- package/dist/types-ts3.4/media-chrome/dialog.d.ts +12 -0
- package/dist/types-ts3.4/media-chrome/time-display.d.ts +9 -0
- package/dist/types-ts3.4/media-theme-mux/icons.d.ts +15 -0
- package/dist/types-ts3.4/media-theme-mux/media-theme-mux.d.ts +29 -0
- package/dist/types-ts3.4/template.d.ts +5 -0
- package/dist/types-ts3.4/utils.d.ts +10 -0
- package/dist/types-ts3.4/video-api.d.ts +53 -0
- package/lang/en.json +32 -0
- package/lang/nl.json +31 -0
- package/package.json +107 -0
- package/src/dialog.ts +54 -0
- package/src/errors.ts +163 -0
- package/src/helpers.ts +131 -0
- package/src/html.ts +165 -0
- package/src/index.ts +952 -0
- package/src/logger.ts +26 -0
- package/src/media-chrome/dialog.ts +192 -0
- package/src/media-chrome/time-display.ts +70 -0
- package/src/media-theme-mux/icons/airplay.svg +8 -0
- package/src/media-theme-mux/icons/captions-off.svg +5 -0
- package/src/media-theme-mux/icons/captions-on.svg +5 -0
- package/src/media-theme-mux/icons/fullscreen-enter.svg +5 -0
- package/src/media-theme-mux/icons/fullscreen-exit.svg +5 -0
- package/src/media-theme-mux/icons/pause.svg +5 -0
- package/src/media-theme-mux/icons/pip-enter.svg +5 -0
- package/src/media-theme-mux/icons/pip-exit.svg +5 -0
- package/src/media-theme-mux/icons/play.svg +5 -0
- package/src/media-theme-mux/icons/seek-backward.svg +13 -0
- package/src/media-theme-mux/icons/seek-forward.svg +13 -0
- package/src/media-theme-mux/icons/volume-high.svg +6 -0
- package/src/media-theme-mux/icons/volume-low.svg +6 -0
- package/src/media-theme-mux/icons/volume-medium.svg +6 -0
- package/src/media-theme-mux/icons/volume-off.svg +6 -0
- package/src/media-theme-mux/icons.ts +33 -0
- package/src/media-theme-mux/media-theme-mux.ts +398 -0
- package/src/media-theme-mux/styles.css +167 -0
- package/src/styles.css +42 -0
- package/src/template.ts +126 -0
- package/src/types.d.ts +52 -0
- package/src/utils.ts +100 -0
- package/src/video-api.ts +298 -0
- package/test/errors.test.js +169 -0
- package/test/helpers.test.js +78 -0
- package/test/player.test.js +696 -0
- package/test/template.test.js +70 -0
- package/test/utils.test.js +21 -0
- package/test/web-test-runner.config.mjs +29 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import 'media-chrome';
|
|
2
|
+
import { html, render } from '../html';
|
|
3
|
+
import '../media-chrome/time-display';
|
|
4
|
+
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import cssStr from './styles.css';
|
|
7
|
+
import * as icons from './icons';
|
|
8
|
+
import { StreamTypes } from '@mux/playback-core';
|
|
9
|
+
|
|
10
|
+
const MediaChromeSizes = {
|
|
11
|
+
LG: 'large',
|
|
12
|
+
SM: 'small',
|
|
13
|
+
XS: 'extra-small',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type ThemeMuxTemplateProps = {
|
|
17
|
+
streamType: string;
|
|
18
|
+
audio: boolean;
|
|
19
|
+
playerSize: string;
|
|
20
|
+
defaultHiddenCaptions: boolean;
|
|
21
|
+
hasCaptions: boolean;
|
|
22
|
+
forwardSeekOffset: number;
|
|
23
|
+
backwardSeekOffset: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const template = (props: ThemeMuxTemplateProps) => html`
|
|
27
|
+
<style>
|
|
28
|
+
${cssStr}
|
|
29
|
+
</style>
|
|
30
|
+
|
|
31
|
+
<media-controller audio="${props.audio || false}" class="size-${props.playerSize}">
|
|
32
|
+
<slot name="media" slot="media"></slot>
|
|
33
|
+
<media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
|
|
34
|
+
${ChromeRenderer(props)}
|
|
35
|
+
<slot></slot>
|
|
36
|
+
</media-controller>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const ChromeRenderer = (props: ThemeMuxTemplateProps) => {
|
|
40
|
+
const { streamType, playerSize, audio } = props;
|
|
41
|
+
if (audio) {
|
|
42
|
+
switch (streamType) {
|
|
43
|
+
case StreamTypes.LIVE:
|
|
44
|
+
case StreamTypes.LL_LIVE: {
|
|
45
|
+
return AudioLiveChrome(props);
|
|
46
|
+
}
|
|
47
|
+
case StreamTypes.DVR:
|
|
48
|
+
case StreamTypes.LL_DVR: {
|
|
49
|
+
return AudioDvrChrome(props);
|
|
50
|
+
}
|
|
51
|
+
case StreamTypes.ON_DEMAND:
|
|
52
|
+
default: {
|
|
53
|
+
return AudioVodChrome(props);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/* eslint-disable no-fallthrough */
|
|
58
|
+
switch (streamType) {
|
|
59
|
+
case StreamTypes.LIVE:
|
|
60
|
+
case StreamTypes.LL_LIVE: {
|
|
61
|
+
switch (playerSize) {
|
|
62
|
+
case MediaChromeSizes.LG:
|
|
63
|
+
return LiveChromeLarge(props);
|
|
64
|
+
case MediaChromeSizes.SM:
|
|
65
|
+
return LiveChromeSmall(props);
|
|
66
|
+
case MediaChromeSizes.XS:
|
|
67
|
+
return LiveChromeExtraSmall(props);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
case StreamTypes.DVR:
|
|
71
|
+
case StreamTypes.LL_DVR: {
|
|
72
|
+
switch (playerSize) {
|
|
73
|
+
case MediaChromeSizes.LG:
|
|
74
|
+
return DvrChromeLarge(props);
|
|
75
|
+
case MediaChromeSizes.SM:
|
|
76
|
+
return DvrChromeSmall(props);
|
|
77
|
+
case MediaChromeSizes.XS:
|
|
78
|
+
return DvrChromeExtraSmall(props);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
case StreamTypes.ON_DEMAND:
|
|
82
|
+
default: {
|
|
83
|
+
switch (playerSize) {
|
|
84
|
+
case MediaChromeSizes.LG:
|
|
85
|
+
return VodChromeLarge(props);
|
|
86
|
+
case MediaChromeSizes.SM:
|
|
87
|
+
return VodChromeSmall(props);
|
|
88
|
+
case MediaChromeSizes.XS:
|
|
89
|
+
return VodChromeExtraSmall(props);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/* eslint-enable */
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// prettier-ignore
|
|
97
|
+
const MediaPlayButton = () => html`
|
|
98
|
+
<media-play-button>
|
|
99
|
+
${icons.Play()}
|
|
100
|
+
${icons.Pause()}
|
|
101
|
+
</media-play-button>
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
// prettier-ignore
|
|
105
|
+
const MediaSeekBackwardButton = (props: Partial<ThemeMuxTemplateProps>) => html`
|
|
106
|
+
<media-seek-backward-button seek-offset="${props.backwardSeekOffset}">
|
|
107
|
+
${icons.SeekBackward({ value: props.backwardSeekOffset })}
|
|
108
|
+
</media-seek-backward-button>
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
// prettier-ignore
|
|
112
|
+
const MediaSeekForwardButton = (props: Partial<ThemeMuxTemplateProps>) => html`
|
|
113
|
+
<media-seek-forward-button seek-offset="${props.forwardSeekOffset}">
|
|
114
|
+
${icons.SeekForward({ value: props.forwardSeekOffset })}
|
|
115
|
+
</media-seek-forward-button>
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
// prettier-ignore
|
|
119
|
+
const MediaMuteButton = () => html`
|
|
120
|
+
<media-mute-button>
|
|
121
|
+
${icons.VolumeHigh()}
|
|
122
|
+
${icons.VolumeMedium()}
|
|
123
|
+
${icons.VolumeLow()}
|
|
124
|
+
${icons.VolumeOff()}
|
|
125
|
+
</media-mute-button>
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
// prettier-ignore
|
|
129
|
+
const MediaCaptionsButton = (props: ThemeMuxTemplateProps) => html`
|
|
130
|
+
<media-captions-button default-showing="${!props.defaultHiddenCaptions}" >
|
|
131
|
+
${icons.CaptionsOff()}
|
|
132
|
+
${icons.CaptionsOn()}
|
|
133
|
+
</media-captions-button>`;
|
|
134
|
+
|
|
135
|
+
// prettier-ignore
|
|
136
|
+
const MediaAirplayButton = () => html`
|
|
137
|
+
<media-airplay-button>
|
|
138
|
+
${icons.Airplay()}
|
|
139
|
+
</media-airplay-button>`;
|
|
140
|
+
|
|
141
|
+
// prettier-ignore
|
|
142
|
+
const MediaPipButton = () => html`
|
|
143
|
+
<media-pip-button>
|
|
144
|
+
${icons.PipEnter()}
|
|
145
|
+
${icons.PipExit()}
|
|
146
|
+
</media-pip-button>`;
|
|
147
|
+
|
|
148
|
+
// prettier-ignore
|
|
149
|
+
const MediaFullscreenButton = () => html`
|
|
150
|
+
<media-fullscreen-button>
|
|
151
|
+
${icons.FullscreenEnter()}
|
|
152
|
+
${icons.FullscreenExit()}
|
|
153
|
+
</media-fullscreen-button>`;
|
|
154
|
+
|
|
155
|
+
export const AudioVodChrome = (props: ThemeMuxTemplateProps) => html`
|
|
156
|
+
<media-control-bar>
|
|
157
|
+
${MediaPlayButton()} ${MediaSeekBackwardButton(props)} ${MediaSeekForwardButton(props)}
|
|
158
|
+
<mxp-time-display></mxp-time-display>
|
|
159
|
+
<media-time-range></media-time-range>
|
|
160
|
+
${MediaMuteButton()}
|
|
161
|
+
<media-volume-range></media-volume-range>
|
|
162
|
+
<media-playback-rate-button></media-playback-rate-button>
|
|
163
|
+
${MediaAirplayButton()}
|
|
164
|
+
<media-cast-button></media-cast-button>
|
|
165
|
+
</media-control-bar>
|
|
166
|
+
`;
|
|
167
|
+
|
|
168
|
+
export const AudioDvrChrome = (props: ThemeMuxTemplateProps) => html`
|
|
169
|
+
<media-control-bar>
|
|
170
|
+
${MediaPlayButton()}
|
|
171
|
+
<slot name="seek-to-live-button"></slot>
|
|
172
|
+
${MediaSeekBackwardButton(props)} ${MediaSeekForwardButton(props)}
|
|
173
|
+
<mxp-time-display></mxp-time-display>
|
|
174
|
+
<media-time-range></media-time-range>
|
|
175
|
+
${MediaMuteButton()}
|
|
176
|
+
<media-volume-range></media-volume-range>
|
|
177
|
+
<media-playback-rate-button></media-playback-rate-button>
|
|
178
|
+
${MediaAirplayButton()}
|
|
179
|
+
<media-cast-button></media-cast-button>
|
|
180
|
+
</media-control-bar>
|
|
181
|
+
`;
|
|
182
|
+
|
|
183
|
+
export const AudioLiveChrome = (_props: ThemeMuxTemplateProps) => html`
|
|
184
|
+
<media-control-bar>
|
|
185
|
+
${MediaPlayButton()}
|
|
186
|
+
<slot name="seek-to-live-button"></slot>
|
|
187
|
+
${MediaMuteButton()}
|
|
188
|
+
<media-volume-range></media-volume-range>
|
|
189
|
+
${MediaAirplayButton()}
|
|
190
|
+
<media-cast-button></media-cast-button>
|
|
191
|
+
</media-control-bar>
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
// prettier-ignore
|
|
195
|
+
export const VodChromeExtraSmall = (props: ThemeMuxTemplateProps) => html`
|
|
196
|
+
<media-control-bar slot="top-chrome">
|
|
197
|
+
${props.hasCaptions ? MediaCaptionsButton(props) : html``}
|
|
198
|
+
<div class="mxp-spacer"></div>
|
|
199
|
+
${MediaAirplayButton()}
|
|
200
|
+
<media-cast-button></media-cast-button>
|
|
201
|
+
${MediaPipButton()}
|
|
202
|
+
</media-control-bar>
|
|
203
|
+
<div slot="centered-chrome" class="mxp-center-controls">
|
|
204
|
+
${MediaPlayButton()}
|
|
205
|
+
</div>
|
|
206
|
+
<media-control-bar>
|
|
207
|
+
${MediaMuteButton()}
|
|
208
|
+
<div class="mxp-spacer"></div>
|
|
209
|
+
${MediaFullscreenButton()}
|
|
210
|
+
</media-control-bar>
|
|
211
|
+
`;
|
|
212
|
+
|
|
213
|
+
// prettier-ignore
|
|
214
|
+
export const VodChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
215
|
+
<media-control-bar slot="top-chrome" style="justify-content: flex-end;">
|
|
216
|
+
${props.hasCaptions ? MediaCaptionsButton(props) : html``}
|
|
217
|
+
${MediaAirplayButton()}
|
|
218
|
+
<media-cast-button></media-cast-button>
|
|
219
|
+
${MediaPipButton()}
|
|
220
|
+
</media-control-bar>
|
|
221
|
+
<div slot="centered-chrome" class="mxp-center-controls">
|
|
222
|
+
${MediaSeekBackwardButton(props)}
|
|
223
|
+
${MediaPlayButton()}
|
|
224
|
+
${MediaSeekForwardButton(props)}
|
|
225
|
+
</div>
|
|
226
|
+
<media-time-range></media-time-range>
|
|
227
|
+
<media-control-bar>
|
|
228
|
+
<mxp-time-display></mxp-time-display>
|
|
229
|
+
${MediaMuteButton()}
|
|
230
|
+
<media-volume-range></media-volume-range>
|
|
231
|
+
<div class="mxp-spacer"></div>
|
|
232
|
+
<media-playback-rate-button></media-playback-rate-button>
|
|
233
|
+
${MediaFullscreenButton()}
|
|
234
|
+
<div class="mxp-padding-2"></div>
|
|
235
|
+
</media-control-bar>
|
|
236
|
+
`;
|
|
237
|
+
|
|
238
|
+
// prettier-ignore
|
|
239
|
+
export const VodChromeLarge = (props: ThemeMuxTemplateProps) => html`
|
|
240
|
+
<div slot="centered-chrome" class="mxp-center-controls">
|
|
241
|
+
${MediaPlayButton()}
|
|
242
|
+
</div>
|
|
243
|
+
<media-time-range></media-time-range>
|
|
244
|
+
<media-control-bar>
|
|
245
|
+
${MediaPlayButton()}
|
|
246
|
+
${MediaSeekBackwardButton(props)}
|
|
247
|
+
${MediaSeekForwardButton(props)}
|
|
248
|
+
<mxp-time-display></mxp-time-display>
|
|
249
|
+
${MediaMuteButton()}
|
|
250
|
+
<media-volume-range></media-volume-range>
|
|
251
|
+
<div class="mxp-spacer"></div>
|
|
252
|
+
<media-playback-rate-button></media-playback-rate-button>
|
|
253
|
+
${props.hasCaptions ? MediaCaptionsButton(props) : html``}
|
|
254
|
+
${MediaAirplayButton()}
|
|
255
|
+
<media-cast-button></media-cast-button>
|
|
256
|
+
${MediaPipButton()}
|
|
257
|
+
${MediaFullscreenButton()}
|
|
258
|
+
<div class="mxp-padding-2"></div>
|
|
259
|
+
</media-control-bar>
|
|
260
|
+
`;
|
|
261
|
+
|
|
262
|
+
// prettier-ignore
|
|
263
|
+
export const LiveChromeExtraSmall = VodChromeExtraSmall;
|
|
264
|
+
|
|
265
|
+
// prettier-ignore
|
|
266
|
+
export const LiveChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
267
|
+
<media-control-bar slot="top-chrome">
|
|
268
|
+
<slot name="seek-to-live-button"></slot>
|
|
269
|
+
<div class="mxp-spacer"></div>
|
|
270
|
+
${props.hasCaptions ? MediaCaptionsButton(props) : html``}
|
|
271
|
+
${MediaAirplayButton()}
|
|
272
|
+
<media-cast-button></media-cast-button>
|
|
273
|
+
${MediaPipButton()}
|
|
274
|
+
</media-control-bar>
|
|
275
|
+
<div slot="centered-chrome" class="mxp-center-controls">
|
|
276
|
+
${MediaPlayButton()}
|
|
277
|
+
</div>
|
|
278
|
+
<media-control-bar>
|
|
279
|
+
${MediaMuteButton()}
|
|
280
|
+
<media-volume-range></media-volume-range>
|
|
281
|
+
<div class="mxp-spacer"></div>
|
|
282
|
+
${MediaFullscreenButton()}
|
|
283
|
+
</media-control-bar>
|
|
284
|
+
`;
|
|
285
|
+
|
|
286
|
+
// prettier-ignore
|
|
287
|
+
export const LiveChromeLarge = (props: ThemeMuxTemplateProps) => html`
|
|
288
|
+
<media-control-bar slot="top-chrome">
|
|
289
|
+
<slot name="seek-to-live-button"></slot>
|
|
290
|
+
</media-control-bar>
|
|
291
|
+
<div slot="centered-chrome" class="mxp-center-controls">
|
|
292
|
+
${MediaPlayButton()}
|
|
293
|
+
</div>
|
|
294
|
+
<media-control-bar>
|
|
295
|
+
${MediaMuteButton()}
|
|
296
|
+
<media-volume-range></media-volume-range>
|
|
297
|
+
<div class="mxp-spacer"></div>
|
|
298
|
+
${props.hasCaptions ? MediaCaptionsButton(props) : html``}
|
|
299
|
+
${MediaAirplayButton()}
|
|
300
|
+
<media-cast-button></media-cast-button>
|
|
301
|
+
${MediaPipButton()}
|
|
302
|
+
${MediaFullscreenButton()}
|
|
303
|
+
</media-control-bar>
|
|
304
|
+
`;
|
|
305
|
+
|
|
306
|
+
// prettier-ignore
|
|
307
|
+
export const DvrChromeExtraSmall = VodChromeExtraSmall;
|
|
308
|
+
|
|
309
|
+
// prettier-ignore
|
|
310
|
+
export const DvrChromeSmall = (props: ThemeMuxTemplateProps) => html`
|
|
311
|
+
<media-control-bar slot="top-chrome" style="justify-content: flex-end;">
|
|
312
|
+
${props.hasCaptions ? MediaCaptionsButton(props) : html``}
|
|
313
|
+
${MediaAirplayButton()}
|
|
314
|
+
<media-cast-button></media-cast-button>
|
|
315
|
+
${MediaPipButton()}
|
|
316
|
+
</media-control-bar>
|
|
317
|
+
<div slot="centered-chrome" class="mxp-center-controls">
|
|
318
|
+
${MediaSeekBackwardButton(props)}
|
|
319
|
+
${MediaPlayButton()}
|
|
320
|
+
${MediaSeekForwardButton(props)}
|
|
321
|
+
</div>
|
|
322
|
+
<media-time-range></media-time-range>
|
|
323
|
+
<media-control-bar>
|
|
324
|
+
${MediaMuteButton()}
|
|
325
|
+
<media-volume-range></media-volume-range>
|
|
326
|
+
<slot name="seek-to-live-button"></slot>
|
|
327
|
+
<div class="mxp-spacer"></div>
|
|
328
|
+
${MediaFullscreenButton()}
|
|
329
|
+
<div class="mxp-padding-2"></div>
|
|
330
|
+
</media-control-bar>
|
|
331
|
+
`;
|
|
332
|
+
|
|
333
|
+
// prettier-ignore
|
|
334
|
+
export const DvrChromeLarge = (props: ThemeMuxTemplateProps) => html`
|
|
335
|
+
<div slot="centered-chrome" class="mxp-center-controls">
|
|
336
|
+
${MediaPlayButton()}
|
|
337
|
+
</div>
|
|
338
|
+
<media-time-range></media-time-range>
|
|
339
|
+
<media-control-bar>
|
|
340
|
+
${MediaPlayButton()}
|
|
341
|
+
${MediaSeekBackwardButton(props)}
|
|
342
|
+
${MediaSeekForwardButton(props)}
|
|
343
|
+
${MediaMuteButton()}
|
|
344
|
+
<media-volume-range></media-volume-range>
|
|
345
|
+
<slot name="seek-to-live-button"></slot>
|
|
346
|
+
<div class="mxp-spacer"></div>
|
|
347
|
+
${props.hasCaptions ? MediaCaptionsButton(props) : html``}
|
|
348
|
+
${MediaAirplayButton()}
|
|
349
|
+
<media-cast-button></media-cast-button>
|
|
350
|
+
${MediaPipButton()}
|
|
351
|
+
${MediaFullscreenButton()}
|
|
352
|
+
<div class="mxp-padding-2"></div>
|
|
353
|
+
</media-control-bar>
|
|
354
|
+
`;
|
|
355
|
+
|
|
356
|
+
function getProps(el: MediaThemeMux, state?: any): ThemeMuxTemplateProps {
|
|
357
|
+
return {
|
|
358
|
+
audio: el.hasAttribute('audio'),
|
|
359
|
+
streamType: el.getAttribute('stream-type'),
|
|
360
|
+
playerSize: el.getAttribute('player-size'),
|
|
361
|
+
defaultHiddenCaptions: el.hasAttribute('default-hidden-captions'),
|
|
362
|
+
hasCaptions: el.hasAttribute('has-captions'),
|
|
363
|
+
forwardSeekOffset: el.getAttribute('forward-seek-offset'),
|
|
364
|
+
backwardSeekOffset: el.getAttribute('backward-seek-offset'),
|
|
365
|
+
...state,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
class MediaThemeMux extends HTMLElement {
|
|
370
|
+
static get observedAttributes() {
|
|
371
|
+
return [
|
|
372
|
+
'audio',
|
|
373
|
+
'stream-type',
|
|
374
|
+
'player-size',
|
|
375
|
+
'default-hidden-captions',
|
|
376
|
+
'has-captions',
|
|
377
|
+
'forward-seek-offset',
|
|
378
|
+
'backward-seek-offset',
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
constructor() {
|
|
383
|
+
super();
|
|
384
|
+
|
|
385
|
+
this.attachShadow({ mode: 'open' });
|
|
386
|
+
render(template(getProps(this)), this.shadowRoot as Node);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
attributeChangedCallback() {
|
|
390
|
+
render(template(getProps(this)), this.shadowRoot as Node);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (!customElements.get('media-theme-mux')) {
|
|
395
|
+
customElements.define('media-theme-mux', MediaThemeMux);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export default MediaThemeMux;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
:host(:not([audio])) {
|
|
2
|
+
--secondary-color: transparent;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
color: var(--primary-color);
|
|
7
|
+
--media-icon-color: var(--primary-color);
|
|
8
|
+
--media-range-thumb-background: var(--primary-color);
|
|
9
|
+
--media-range-bar-color: var(--primary-color);
|
|
10
|
+
--media-control-background: var(--secondary-color);
|
|
11
|
+
--media-control-hover-background: var(--secondary-color);
|
|
12
|
+
--media-time-buffered-color: rgba(255, 255, 255, 0.7);
|
|
13
|
+
--media-range-track-background: rgba(255, 255, 255, 0.5);
|
|
14
|
+
--media-range-track-border-radius: 3px;
|
|
15
|
+
display: inline-block;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([audio]) ::slotted([slot='media']) {
|
|
21
|
+
height: 0px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([audio]) media-controller {
|
|
25
|
+
background: transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([audio]) media-controller::part(vertical-layer) {
|
|
29
|
+
background: transparent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([audio]) media-control-bar {
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
media-airplay-button[media-airplay-unavailable],
|
|
37
|
+
media-cast-button[media-cast-unavailable],
|
|
38
|
+
media-volume-range[media-volume-unavailable],
|
|
39
|
+
media-airplay-button[media-airplay-unavailable] {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
media-volume-range[media-volume-unavailable] {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
media-pip-button[media-pip-unavailable] {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
media-controller {
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host(:not([audio])) media-time-range {
|
|
57
|
+
padding: var(--mux-time-range-padding, 0 10px);
|
|
58
|
+
z-index: 10;
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 22px;
|
|
61
|
+
--media-range-track-translate-y: 6px;
|
|
62
|
+
background: linear-gradient(180deg, transparent, transparent 15px, var(--media-control-background) 15px);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
media-control-bar {
|
|
66
|
+
--media-button-icon-width: 18px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
media-control-bar :is([role='button'], [role='switch'], button) {
|
|
70
|
+
height: 44px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
media-cast-button {
|
|
74
|
+
width: 40px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.size-extra-small media-control-bar [role='button'],
|
|
78
|
+
.size-extra-small media-control-bar [role='switch'] {
|
|
79
|
+
height: auto;
|
|
80
|
+
padding: 4.4% 3.2%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.mxp-spacer {
|
|
84
|
+
flex-grow: 1;
|
|
85
|
+
height: 100%;
|
|
86
|
+
background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Add a small space on the right to have the play button and
|
|
90
|
+
* fullscreen button aligned in relation to the progress bar. */
|
|
91
|
+
.size-large .mxp-padding-2 {
|
|
92
|
+
width: 2px;
|
|
93
|
+
height: 100%;
|
|
94
|
+
background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
media-controller::part(vertical-layer) {
|
|
98
|
+
transition: background-color 1s;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
|
|
102
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
103
|
+
transition: background-color 0.25s;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.mxp-center-controls {
|
|
107
|
+
--media-button-icon-width: 100%;
|
|
108
|
+
--media-button-icon-height: auto;
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
width: 100%;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-flow: row;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.mxp-center-controls media-play-button {
|
|
118
|
+
--media-control-background: transparent;
|
|
119
|
+
--media-control-hover-background: transparent;
|
|
120
|
+
padding: 0;
|
|
121
|
+
width: max(27px, min(9%, 90px));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.mxp-center-controls media-seek-backward-button,
|
|
125
|
+
.mxp-center-controls media-seek-forward-button {
|
|
126
|
+
--media-control-background: transparent;
|
|
127
|
+
--media-control-hover-background: transparent;
|
|
128
|
+
padding: 0;
|
|
129
|
+
margin: 0 10%;
|
|
130
|
+
width: min(7%, 70px);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
media-loading-indicator {
|
|
134
|
+
--media-loading-icon-width: 100%;
|
|
135
|
+
--media-button-icon-height: auto;
|
|
136
|
+
pointer-events: none;
|
|
137
|
+
position: absolute;
|
|
138
|
+
width: min(15%, 150px);
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-flow: row;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Intentionally don't target the div for transition but the children
|
|
146
|
+
of the div. Prevents messing with media-chrome's autohide feature. */
|
|
147
|
+
media-loading-indicator + div * {
|
|
148
|
+
transition: opacity 0.15s;
|
|
149
|
+
opacity: 1;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
|
|
153
|
+
opacity: 0;
|
|
154
|
+
transition-delay: 400ms;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
media-volume-range {
|
|
158
|
+
width: min(100%, 100px);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
media-time-display {
|
|
162
|
+
white-space: nowrap;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:is(media-time-display, media-text-display, media-playback-rate-button) {
|
|
166
|
+
color: inherit;
|
|
167
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* Hide custom elements that are not defined yet */
|
|
6
|
+
:not(:defined) {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
a {
|
|
11
|
+
color: #fff;
|
|
12
|
+
font-size: 0.9em;
|
|
13
|
+
text-decoration: underline;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
media-controller {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.mxp-seek-to-live-button {
|
|
22
|
+
height: 44px;
|
|
23
|
+
background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
|
|
24
|
+
color: white;
|
|
25
|
+
border: none;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.mxp-seek-to-live-button[aria-disabled] {
|
|
30
|
+
cursor: default;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.mxp-seek-to-live-button::before {
|
|
35
|
+
content: '● ';
|
|
36
|
+
color: rgb(118, 118, 118);
|
|
37
|
+
padding-right: 5px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.mxp-seek-to-live-button[aria-disabled]::before {
|
|
41
|
+
color: #fb3c4d;
|
|
42
|
+
}
|