@mux/mux-player 0.1.0-canary.0-556dabf

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +196 -0
  2. package/README.md +231 -0
  3. package/dist/index.cjs.js +1432 -0
  4. package/dist/index.mjs +709 -0
  5. package/dist/mux-player.js +1478 -0
  6. package/dist/mux-player.mjs +1478 -0
  7. package/dist/tsconfig.tsbuildinfo +1 -0
  8. package/dist/types/dialog.d.ts +6 -0
  9. package/dist/types/errors.d.ts +6 -0
  10. package/dist/types/helpers.d.ts +26 -0
  11. package/dist/types/html.d.ts +18 -0
  12. package/dist/types/index.d.ts +199 -0
  13. package/dist/types/logger.d.ts +5 -0
  14. package/dist/types/media-chrome/dialog.d.ts +12 -0
  15. package/dist/types/media-chrome/time-display.d.ts +9 -0
  16. package/dist/types/media-theme-mux/icons.d.ts +15 -0
  17. package/dist/types/media-theme-mux/media-theme-mux.d.ts +29 -0
  18. package/dist/types/template.d.ts +5 -0
  19. package/dist/types/utils.d.ts +10 -0
  20. package/dist/types/video-api.d.ts +64 -0
  21. package/dist/types-ts3.4/dialog.d.ts +6 -0
  22. package/dist/types-ts3.4/errors.d.ts +6 -0
  23. package/dist/types-ts3.4/helpers.d.ts +26 -0
  24. package/dist/types-ts3.4/html.d.ts +18 -0
  25. package/dist/types-ts3.4/index.d.ts +180 -0
  26. package/dist/types-ts3.4/logger.d.ts +5 -0
  27. package/dist/types-ts3.4/media-chrome/dialog.d.ts +12 -0
  28. package/dist/types-ts3.4/media-chrome/time-display.d.ts +9 -0
  29. package/dist/types-ts3.4/media-theme-mux/icons.d.ts +15 -0
  30. package/dist/types-ts3.4/media-theme-mux/media-theme-mux.d.ts +29 -0
  31. package/dist/types-ts3.4/template.d.ts +5 -0
  32. package/dist/types-ts3.4/utils.d.ts +10 -0
  33. package/dist/types-ts3.4/video-api.d.ts +53 -0
  34. package/lang/en.json +32 -0
  35. package/lang/nl.json +31 -0
  36. package/package.json +106 -0
  37. package/src/dialog.ts +54 -0
  38. package/src/errors.ts +163 -0
  39. package/src/helpers.ts +131 -0
  40. package/src/html.ts +165 -0
  41. package/src/index.ts +952 -0
  42. package/src/logger.ts +26 -0
  43. package/src/media-chrome/dialog.ts +192 -0
  44. package/src/media-chrome/time-display.ts +70 -0
  45. package/src/media-theme-mux/icons/airplay.svg +8 -0
  46. package/src/media-theme-mux/icons/captions-off.svg +5 -0
  47. package/src/media-theme-mux/icons/captions-on.svg +5 -0
  48. package/src/media-theme-mux/icons/fullscreen-enter.svg +5 -0
  49. package/src/media-theme-mux/icons/fullscreen-exit.svg +5 -0
  50. package/src/media-theme-mux/icons/pause.svg +5 -0
  51. package/src/media-theme-mux/icons/pip-enter.svg +5 -0
  52. package/src/media-theme-mux/icons/pip-exit.svg +5 -0
  53. package/src/media-theme-mux/icons/play.svg +5 -0
  54. package/src/media-theme-mux/icons/seek-backward.svg +13 -0
  55. package/src/media-theme-mux/icons/seek-forward.svg +13 -0
  56. package/src/media-theme-mux/icons/volume-high.svg +6 -0
  57. package/src/media-theme-mux/icons/volume-low.svg +6 -0
  58. package/src/media-theme-mux/icons/volume-medium.svg +6 -0
  59. package/src/media-theme-mux/icons/volume-off.svg +6 -0
  60. package/src/media-theme-mux/icons.ts +33 -0
  61. package/src/media-theme-mux/media-theme-mux.ts +398 -0
  62. package/src/media-theme-mux/styles.css +167 -0
  63. package/src/styles.css +42 -0
  64. package/src/template.ts +126 -0
  65. package/src/types.d.ts +52 -0
  66. package/src/utils.ts +100 -0
  67. package/src/video-api.ts +298 -0
  68. package/test/errors.test.js +169 -0
  69. package/test/helpers.test.js +78 -0
  70. package/test/player.test.js +696 -0
  71. package/test/template.test.js +70 -0
  72. package/test/utils.test.js +21 -0
  73. package/test/web-test-runner.config.mjs +29 -0
  74. package/tsconfig.json +21 -0
@@ -0,0 +1,70 @@
1
+ import { assert } from '@open-wc/testing';
2
+ import { content } from '../src/template.ts';
3
+ import { render } from '../src/html.ts';
4
+
5
+ const minify = (html) => html.trim().replace(/>\s+</g, '><');
6
+
7
+ describe('<mux-player> template render', () => {
8
+ const div = document.createElement('div');
9
+
10
+ it('default template without props', function () {
11
+ render(content({}), div);
12
+ assert.equal(
13
+ minify(div.innerHTML),
14
+ '<media-theme-mux class="size-" stream-type="" player-size="" has-captions="" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version=""></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><p></p></mxp-dialog></media-theme-mux>'
15
+ );
16
+ });
17
+
18
+ it('template extra-small', function () {
19
+ render(
20
+ content({
21
+ playerSize: 'extra-small',
22
+ streamType: 'on-demand',
23
+ dialog: {
24
+ title: 'Errr',
25
+ },
26
+ }),
27
+ div
28
+ );
29
+ div.querySelectorAll('svg').forEach((svg) => svg.remove());
30
+ assert.equal(
31
+ minify(div.innerHTML),
32
+ '<media-theme-mux class="size-extra-small" stream-type="on-demand" player-size="extra-small" has-captions="" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><h3>Errr</h3><p></p></mxp-dialog></media-theme-mux>'
33
+ );
34
+ });
35
+
36
+ it('template VodChromeLarge with captions', function () {
37
+ render(
38
+ content({
39
+ playerSize: 'large',
40
+ streamType: 'on-demand',
41
+ hasCaptions: true,
42
+ }),
43
+ div
44
+ );
45
+ div.querySelectorAll('svg').forEach((svg) => svg.remove());
46
+ assert.equal(
47
+ minify(div.innerHTML),
48
+ '<media-theme-mux class="size-large" stream-type="on-demand" player-size="large" has-captions="" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><p></p></mxp-dialog></media-theme-mux>'
49
+ );
50
+ });
51
+
52
+ it('template VodChromeLarge without captions', function () {
53
+ render(
54
+ content({
55
+ playerSize: 'large',
56
+ streamType: 'on-demand',
57
+ hasCaptions: false,
58
+ dialog: {
59
+ title: 'Errr',
60
+ },
61
+ }),
62
+ div
63
+ );
64
+ div.querySelectorAll('svg').forEach((svg) => svg.remove());
65
+ assert.equal(
66
+ minify(div.innerHTML),
67
+ '<media-theme-mux class="size-large" stream-type="on-demand" player-size="large" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><h3>Errr</h3><p></p></mxp-dialog></media-theme-mux>'
68
+ );
69
+ });
70
+ });
@@ -0,0 +1,21 @@
1
+ import { assert } from '@open-wc/testing';
2
+ import { stylePropsToString, uniqueId } from '../src/utils.ts';
3
+
4
+ describe('utils', () => {
5
+ it('stylePropsToString', function () {
6
+ assert.equal(
7
+ stylePropsToString({
8
+ fontSize: '12px',
9
+ color: '#fff',
10
+ }),
11
+ 'font-size: 12px; color: #fff;'
12
+ );
13
+ });
14
+
15
+ it('uniqueId', function () {
16
+ let id = uniqueId('uid');
17
+ assert.equal(id, 'uid1');
18
+
19
+ assert.notEqual(uniqueId('uid'), id);
20
+ });
21
+ });
@@ -0,0 +1,29 @@
1
+ import { esbuildPlugin } from '@web/dev-server-esbuild';
2
+ import { importMapsPlugin } from '@web/dev-server-import-maps';
3
+
4
+ export default {
5
+ nodeResolve: true,
6
+ plugins: [
7
+ importMapsPlugin({
8
+ inject: {
9
+ importMap: {
10
+ imports: {
11
+ // see shared/test-esm-exports/README.md for more information on this configuration
12
+ '/test/': '/packages/mux-player/test/',
13
+ 'hls.js': '/node_modules/@mux/test-esm-exports/dist/hls.js',
14
+ 'mux-embed': '/node_modules/@mux/test-esm-exports/dist/mux-embed.js',
15
+ },
16
+ },
17
+ },
18
+ }),
19
+ esbuildPlugin({
20
+ ts: true,
21
+ json: true,
22
+ loaders: { '.css': 'text', '.svg': 'text' },
23
+ }),
24
+ ],
25
+ coverageConfig: {
26
+ report: true,
27
+ include: ['src/**/*'],
28
+ },
29
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "src",
4
+ "outDir": "dist",
5
+ "incremental": true,
6
+ "target": "ES2019",
7
+ "module": "es6",
8
+ "declaration": true,
9
+ "sourceMap": true,
10
+ "composite": true,
11
+ "strict": true,
12
+ "noImplicitAny": true,
13
+ "moduleResolution": "Node",
14
+ "baseUrl": "./packages",
15
+ "esModuleInterop": true,
16
+ "skipLibCheck": true,
17
+ "forceConsistentCasingInFileNames": true,
18
+ "typeRoots": ["node_modules/@types", "../../types"]
19
+ },
20
+ "include": ["src/**/*", "../../types"]
21
+ }