@wix/video 1.72.0
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/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/cjs/Video.js +121 -0
- package/dist/cjs/Video.js.map +1 -0
- package/dist/cjs/Video.module.scss +27 -0
- package/dist/cjs/Video.stories.js +68 -0
- package/dist/cjs/Video.stories.js.map +1 -0
- package/dist/cjs/custom-element/WowVideo.js +88 -0
- package/dist/cjs/custom-element/WowVideo.js.map +1 -0
- package/dist/cjs/custom-element/registry.js +34 -0
- package/dist/cjs/custom-element/registry.js.map +1 -0
- package/dist/cjs/custom-element/utils.js +138 -0
- package/dist/cjs/custom-element/utils.js.map +1 -0
- package/dist/cjs/custom-element/videoLayout.js +120 -0
- package/dist/cjs/custom-element/videoLayout.js.map +1 -0
- package/dist/cjs/customElementInit.js +10 -0
- package/dist/cjs/customElementInit.js.map +1 -0
- package/dist/cjs/dataManifest.js +53 -0
- package/dist/cjs/dataManifest.js.map +1 -0
- package/dist/cjs/external-types.d.js +2 -0
- package/dist/cjs/external-types.d.js.map +1 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/storybook/Container.js +33 -0
- package/dist/cjs/storybook/Container.js.map +1 -0
- package/dist/cjs/storybook/args.js +178 -0
- package/dist/cjs/storybook/args.js.map +1 -0
- package/dist/cjs/test-types.d.js +2 -0
- package/dist/cjs/test-types.d.js.map +1 -0
- package/dist/cjs/types.js +4 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/Video.js +95 -0
- package/dist/esm/Video.js.map +1 -0
- package/dist/esm/Video.module.scss +27 -0
- package/dist/esm/Video.stories.js +47 -0
- package/dist/esm/Video.stories.js.map +1 -0
- package/dist/esm/custom-element/WowVideo.js +83 -0
- package/dist/esm/custom-element/WowVideo.js.map +1 -0
- package/dist/esm/custom-element/registry.js +29 -0
- package/dist/esm/custom-element/registry.js.map +1 -0
- package/dist/esm/custom-element/utils.js +131 -0
- package/dist/esm/custom-element/utils.js.map +1 -0
- package/dist/esm/custom-element/videoLayout.js +117 -0
- package/dist/esm/custom-element/videoLayout.js.map +1 -0
- package/dist/esm/customElementInit.js +13 -0
- package/dist/esm/customElementInit.js.map +1 -0
- package/dist/esm/dataManifest.js +49 -0
- package/dist/esm/dataManifest.js.map +1 -0
- package/dist/esm/external-types.d.js +2 -0
- package/dist/esm/external-types.d.js.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/storybook/Container.js +21 -0
- package/dist/esm/storybook/Container.js.map +1 -0
- package/dist/esm/storybook/args.js +174 -0
- package/dist/esm/storybook/args.js.map +1 -0
- package/dist/esm/test-types.d.js +2 -0
- package/dist/esm/test-types.d.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/statics/189.chunk.js +35383 -0
- package/dist/statics/189.chunk.js.map +1 -0
- package/dist/statics/189.chunk.min.js +2 -0
- package/dist/statics/189.chunk.min.js.map +1 -0
- package/dist/statics/janet/110.8a580c2d.iframe.bundle.js +10826 -0
- package/dist/statics/janet/110.8a580c2d.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/134.6007b391.iframe.bundle.js +484 -0
- package/dist/statics/janet/134.6007b391.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/134.d48c36bc94ecd2280c0a.manager.bundle.js +1 -0
- package/dist/statics/janet/317.2df397a1e1f34d5a30fd.manager.bundle.js +1 -0
- package/dist/statics/janet/326.e8fcdb36.iframe.bundle.js +1998 -0
- package/dist/statics/janet/326.e8fcdb36.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/326.ff40cdf1778fd94969c8.manager.bundle.js +2 -0
- package/dist/statics/janet/326.ff40cdf1778fd94969c8.manager.bundle.js.LICENSE.txt +31 -0
- package/dist/statics/janet/470.aab6696c.iframe.bundle.js +35380 -0
- package/dist/statics/janet/470.aab6696c.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/599.37d4aa34.iframe.bundle.js +3294 -0
- package/dist/statics/janet/599.37d4aa34.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/599.47c7dacc8997e4d71eac.manager.bundle.js +1 -0
- package/dist/statics/janet/61.5cb88eb5.iframe.bundle.js +2652 -0
- package/dist/statics/janet/61.5cb88eb5.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/61.a575d4776ab0d42da5c8.manager.bundle.js +1 -0
- package/dist/statics/janet/673.59f2a23a.iframe.bundle.js +173 -0
- package/dist/statics/janet/673.59f2a23a.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/725.0db49c6347dfe44ace2d.manager.bundle.js +2 -0
- package/dist/statics/janet/725.0db49c6347dfe44ace2d.manager.bundle.js.LICENSE.txt +8 -0
- package/dist/statics/janet/725.cbba2e4b.iframe.bundle.js +10451 -0
- package/dist/statics/janet/725.cbba2e4b.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/734.428ea23e9773cd26fb57.manager.bundle.js +2 -0
- package/dist/statics/janet/734.428ea23e9773cd26fb57.manager.bundle.js.LICENSE.txt +94 -0
- package/dist/statics/janet/833.75275036.iframe.bundle.js +6777 -0
- package/dist/statics/janet/833.75275036.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/833.ef639b005d7b76723595.manager.bundle.js +2 -0
- package/dist/statics/janet/833.ef639b005d7b76723595.manager.bundle.js.LICENSE.txt +12 -0
- package/dist/statics/janet/W-06.svg +1 -0
- package/dist/statics/janet/favicon.ico +0 -0
- package/dist/statics/janet/iframe.html +364 -0
- package/dist/statics/janet/index.html +59 -0
- package/dist/statics/janet/janet.json +10 -0
- package/dist/statics/janet/main.666d4853f3d62ab20aa1.manager.bundle.js +1 -0
- package/dist/statics/janet/main.d8a321d6.iframe.bundle.js +73260 -0
- package/dist/statics/janet/main.d8a321d6.iframe.bundle.js.map +1 -0
- package/dist/statics/janet/project.json +1 -0
- package/dist/statics/janet/runtime~main.2195d24e465f19ad9c9a.manager.bundle.js +1 -0
- package/dist/statics/janet/w-06.ico +0 -0
- package/dist/statics/manifest.json +4 -0
- package/dist/statics/manifest.min.json +4 -0
- package/dist/statics/video.css +10 -0
- package/dist/statics/video.css.map +1 -0
- package/dist/statics/video.min.css +1 -0
- package/dist/statics/video.rtl.css +8 -0
- package/dist/statics/video.rtl.min.css +1 -0
- package/dist/statics/video.umd.js +5990 -0
- package/dist/statics/video.umd.js.map +1 -0
- package/dist/statics/video.umd.min.js +2 -0
- package/dist/statics/video.umd.min.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/Video.d.ts +5 -0
- package/dist/types/Video.d.ts.map +1 -0
- package/dist/types/Video.stories.d.ts +20 -0
- package/dist/types/Video.stories.d.ts.map +1 -0
- package/dist/types/custom-element/WowVideo.d.ts +4 -0
- package/dist/types/custom-element/WowVideo.d.ts.map +1 -0
- package/dist/types/custom-element/registry.d.ts +3 -0
- package/dist/types/custom-element/registry.d.ts.map +1 -0
- package/dist/types/custom-element/utils.d.ts +11 -0
- package/dist/types/custom-element/utils.d.ts.map +1 -0
- package/dist/types/custom-element/videoLayout.d.ts +35 -0
- package/dist/types/custom-element/videoLayout.d.ts.map +1 -0
- package/dist/types/customElementInit.d.ts +4 -0
- package/dist/types/customElementInit.d.ts.map +1 -0
- package/dist/types/dataManifest.d.ts +2 -0
- package/dist/types/dataManifest.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/storybook/Container.d.ts +5 -0
- package/dist/types/storybook/Container.d.ts.map +1 -0
- package/dist/types/storybook/args.d.ts +174 -0
- package/dist/types/storybook/args.d.ts.map +1 -0
- package/dist/types/types.d.ts +62 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getVideoSource = getVideoSource;
|
|
5
|
+
exports.setVideoFocalPoint = setVideoFocalPoint;
|
|
6
|
+
exports.sortQualities = sortQualities;
|
|
7
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
8
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
|
+
const STATIC_VIDEO_URL = 'https://video.wixstatic.com/';
|
|
10
|
+
const STATIC_ADAPTIVE_VIDEO_URL = 'https://files.wix.com/';
|
|
11
|
+
const isAbsoluteUrl = url => url.startsWith('http://') || url.startsWith('https://');
|
|
12
|
+
function sortQualities(sources) {
|
|
13
|
+
return sources.sort((a, b) => a.width * a.height - b.width * b.height);
|
|
14
|
+
}
|
|
15
|
+
function getCompleteUrl(url, staticVideoUrl) {
|
|
16
|
+
const completeUrl = isAbsoluteUrl(url) ? new URL(url) : new URL(url, staticVideoUrl);
|
|
17
|
+
return completeUrl.href;
|
|
18
|
+
}
|
|
19
|
+
function getVideoQualityBySize(sources, {
|
|
20
|
+
width,
|
|
21
|
+
height
|
|
22
|
+
}) {
|
|
23
|
+
const targetQuality = sources.find(value => value.width * value.height > width * height);
|
|
24
|
+
return targetQuality || sources[sources.length - 1];
|
|
25
|
+
}
|
|
26
|
+
function getScaleFactor(containerWidth, containerHeight, videoWidth, videoHeight) {
|
|
27
|
+
return {
|
|
28
|
+
wScale: containerWidth / videoWidth,
|
|
29
|
+
hScale: containerHeight / videoHeight
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function getVideoDimension(videoScale, videoWidth, videoHeight) {
|
|
33
|
+
const scale = Math.min(videoScale.wScale, videoScale.hScale);
|
|
34
|
+
return {
|
|
35
|
+
width: Math.round(videoWidth * scale),
|
|
36
|
+
height: Math.round(videoHeight * scale)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function setVideoFocalPoint(videoNode, focalPoint) {
|
|
40
|
+
const focalX = (focalPoint == null ? void 0 : focalPoint.x) ?? 50;
|
|
41
|
+
const focalY = (focalPoint == null ? void 0 : focalPoint.y) ?? 50;
|
|
42
|
+
videoNode.style.setProperty('--focal-x', focalX.toString());
|
|
43
|
+
videoNode.style.setProperty('--focal-y', focalY.toString());
|
|
44
|
+
}
|
|
45
|
+
async function getVideoSource(width, height, uri, qualityPolicy, sources, adaptiveSources, duration, onError) {
|
|
46
|
+
const hasProgressiveSources = sources && sources.length > 0;
|
|
47
|
+
const hasAbsoluteUri = uri && isAbsoluteUrl(uri);
|
|
48
|
+
const shouldSkipAdaptiveShortVideo = duration && duration < 40;
|
|
49
|
+
if (qualityPolicy === 'adaptive' && adaptiveSources && adaptiveSources.length > 0 && !shouldSkipAdaptiveShortVideo) {
|
|
50
|
+
const hlsSource = adaptiveSources.find(s => s.format === 'hls');
|
|
51
|
+
const Hls = await Promise.resolve().then(() => _interopRequireWildcard(require('hls.js')));
|
|
52
|
+
if (hlsSource && Hls && Hls.default.isSupported()) {
|
|
53
|
+
const videoSourceUrl = getCompleteUrl(hlsSource.uri, STATIC_ADAPTIVE_VIDEO_URL);
|
|
54
|
+
const patchVideoSource = videoNode => {
|
|
55
|
+
const hls = new Hls.default();
|
|
56
|
+
hls.loadSource(videoSourceUrl);
|
|
57
|
+
hls.attachMedia(videoNode);
|
|
58
|
+
hls.on(Hls.default.Events.ERROR, (_, data) => {
|
|
59
|
+
if (data.fatal) {
|
|
60
|
+
switch (data.type) {
|
|
61
|
+
case Hls.default.ErrorTypes.NETWORK_ERROR:
|
|
62
|
+
hls.startLoad();
|
|
63
|
+
if (onError) {
|
|
64
|
+
onError(new Error(`HLS Network Error: ${data.details}.\nAttempting to reconnect...`));
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case Hls.default.ErrorTypes.MEDIA_ERROR:
|
|
68
|
+
hls.recoverMediaError();
|
|
69
|
+
if (onError) {
|
|
70
|
+
onError(new Error(`HLS Media Error: ${data.details}.\nAttempting to recover...`));
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
hls.destroy();
|
|
75
|
+
if (onError) {
|
|
76
|
+
onError(new Error(`HLS Unknown Error: ${data.details}.\nUnrecoverable playback error`));
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
videoSourceUrl,
|
|
85
|
+
patchVideoSource
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (hasProgressiveSources) {
|
|
90
|
+
const highestQuality = sources[sources.length - 1];
|
|
91
|
+
if (qualityPolicy === 'highest') {
|
|
92
|
+
var _highestQuality$types;
|
|
93
|
+
const url = (_highestQuality$types = highestQuality.types.find(type => type.format === 'mp4')) == null ? void 0 : _highestQuality$types.uri;
|
|
94
|
+
if (url) {
|
|
95
|
+
const videoSourceUrl = getCompleteUrl(url, STATIC_VIDEO_URL);
|
|
96
|
+
return {
|
|
97
|
+
videoSourceUrl,
|
|
98
|
+
patchVideoSource: videoNode => {
|
|
99
|
+
videoNode.src = videoSourceUrl;
|
|
100
|
+
videoNode.load();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
var _targetQuality$types$;
|
|
106
|
+
const videoWidth = parseInt(highestQuality.width.toString(), 10);
|
|
107
|
+
const videoHeight = parseInt(highestQuality.height.toString(), 10);
|
|
108
|
+
const scaleFactor = getScaleFactor(width, height, videoWidth, videoHeight);
|
|
109
|
+
const videoScaledDimensions = getVideoDimension(scaleFactor, videoWidth, videoHeight);
|
|
110
|
+
const targetQuality = getVideoQualityBySize(sources, videoScaledDimensions);
|
|
111
|
+
const url = (_targetQuality$types$ = targetQuality.types.find(type => type.format === 'mp4')) == null ? void 0 : _targetQuality$types$.uri;
|
|
112
|
+
if (url) {
|
|
113
|
+
const videoSourceUrl = getCompleteUrl(url, STATIC_VIDEO_URL);
|
|
114
|
+
return {
|
|
115
|
+
videoSourceUrl,
|
|
116
|
+
patchVideoSource: videoNode => {
|
|
117
|
+
videoNode.src = videoSourceUrl;
|
|
118
|
+
videoNode.load();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (hasAbsoluteUri) {
|
|
125
|
+
return {
|
|
126
|
+
videoSourceUrl: uri,
|
|
127
|
+
patchVideoSource: videoNode => {
|
|
128
|
+
videoNode.src = uri;
|
|
129
|
+
videoNode.load();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
videoSourceUrl: '',
|
|
135
|
+
patchVideoSource: () => {}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["STATIC_VIDEO_URL","STATIC_ADAPTIVE_VIDEO_URL","isAbsoluteUrl","url","startsWith","sortQualities","sources","sort","a","b","width","height","getCompleteUrl","staticVideoUrl","completeUrl","URL","href","getVideoQualityBySize","targetQuality","find","value","length","getScaleFactor","containerWidth","containerHeight","videoWidth","videoHeight","wScale","hScale","getVideoDimension","videoScale","scale","Math","min","round","setVideoFocalPoint","videoNode","focalPoint","focalX","x","focalY","y","style","setProperty","toString","getVideoSource","uri","qualityPolicy","adaptiveSources","duration","onError","hasProgressiveSources","hasAbsoluteUri","shouldSkipAdaptiveShortVideo","hlsSource","s","format","Hls","Promise","resolve","then","_interopRequireWildcard","require","default","isSupported","videoSourceUrl","patchVideoSource","hls","loadSource","attachMedia","on","Events","ERROR","_","data","fatal","type","ErrorTypes","NETWORK_ERROR","startLoad","Error","details","MEDIA_ERROR","recoverMediaError","destroy","highestQuality","_highestQuality$types","types","src","load","_targetQuality$types$","parseInt","scaleFactor","videoScaledDimensions"],"sources":["../../../src/custom-element/utils.ts"],"sourcesContent":["import { AdaptiveVideoSource, QualityPolicy, VideoSource } from '../types';\n\nconst STATIC_VIDEO_URL = 'https://video.wixstatic.com/';\nconst STATIC_ADAPTIVE_VIDEO_URL = 'https://files.wix.com/';\n\nconst isAbsoluteUrl = (url: string) =>\n url.startsWith('http://') || url.startsWith('https://');\n\nexport function sortQualities(sources: VideoSource[]) {\n return sources.sort((a, b) => a.width * a.height - b.width * b.height);\n}\n\nfunction getCompleteUrl(url: string, staticVideoUrl?: string): string {\n const completeUrl = isAbsoluteUrl(url)\n ? new URL(url)\n : new URL(url, staticVideoUrl);\n return completeUrl.href;\n}\n\nfunction getVideoQualityBySize(\n sources: VideoSource[],\n { width, height }: { width: number; height: number },\n): VideoSource {\n const targetQuality = sources.find(\n (value) => value.width * value.height > width * height,\n );\n\n return targetQuality || sources[sources.length - 1];\n}\n\nfunction getScaleFactor(\n containerWidth: number,\n containerHeight: number,\n videoWidth: number,\n videoHeight: number,\n): { wScale: number; hScale: number } {\n return {\n wScale: containerWidth / videoWidth,\n hScale: containerHeight / videoHeight,\n };\n}\n\nfunction getVideoDimension(\n videoScale: { wScale: number; hScale: number },\n videoWidth: number,\n videoHeight: number,\n): { width: number; height: number } {\n const scale: number = Math.min(videoScale.wScale, videoScale.hScale);\n\n return {\n width: Math.round(videoWidth * scale),\n height: Math.round(videoHeight * scale),\n };\n}\n\nexport function setVideoFocalPoint(\n videoNode: HTMLVideoElement,\n focalPoint: { x: number; y: number },\n) {\n const focalX = focalPoint?.x ?? 50;\n const focalY = focalPoint?.y ?? 50;\n videoNode.style.setProperty('--focal-x', focalX.toString());\n videoNode.style.setProperty('--focal-y', focalY.toString());\n}\n\nexport async function getVideoSource(\n width: number,\n height: number,\n uri: string,\n qualityPolicy: QualityPolicy,\n sources?: VideoSource[],\n adaptiveSources?: AdaptiveVideoSource[],\n duration?: number,\n onError?: (error: Error) => void,\n): Promise<{\n videoSourceUrl: string;\n patchVideoSource: (videoNode: HTMLVideoElement) => void;\n}> {\n const hasProgressiveSources = sources && sources.length > 0;\n const hasAbsoluteUri = uri && isAbsoluteUrl(uri);\n const shouldSkipAdaptiveShortVideo = duration && duration < 40;\n\n if (\n qualityPolicy === 'adaptive' &&\n adaptiveSources &&\n adaptiveSources.length > 0 &&\n !shouldSkipAdaptiveShortVideo\n ) {\n const hlsSource = adaptiveSources.find((s) => s.format === 'hls');\n const Hls = await import('hls.js');\n if (hlsSource && Hls && Hls.default.isSupported()) {\n const videoSourceUrl = getCompleteUrl(\n hlsSource.uri,\n STATIC_ADAPTIVE_VIDEO_URL,\n );\n const patchVideoSource = (videoNode: HTMLVideoElement) => {\n const hls = new Hls.default();\n hls.loadSource(videoSourceUrl);\n hls.attachMedia(videoNode);\n\n hls.on(Hls.default.Events.ERROR, (_, data) => {\n if (data.fatal) {\n switch (data.type) {\n case Hls.default.ErrorTypes.NETWORK_ERROR:\n hls.startLoad();\n if (onError) {\n onError(\n new Error(\n `HLS Network Error: ${data.details}.\\nAttempting to reconnect...`,\n ),\n );\n }\n break;\n case Hls.default.ErrorTypes.MEDIA_ERROR:\n hls.recoverMediaError();\n if (onError) {\n onError(\n new Error(\n `HLS Media Error: ${data.details}.\\nAttempting to recover...`,\n ),\n );\n }\n break;\n default:\n hls.destroy();\n if (onError) {\n onError(\n new Error(\n `HLS Unknown Error: ${data.details}.\\nUnrecoverable playback error`,\n ),\n );\n }\n break;\n }\n }\n });\n };\n return { videoSourceUrl, patchVideoSource };\n }\n }\n if (hasProgressiveSources) {\n const highestQuality = sources[sources.length - 1];\n if (qualityPolicy === 'highest') {\n const url = highestQuality.types.find(\n (type) => type.format === 'mp4',\n )?.uri;\n if (url) {\n const videoSourceUrl = getCompleteUrl(url, STATIC_VIDEO_URL);\n return {\n videoSourceUrl,\n patchVideoSource: (videoNode: HTMLVideoElement) => {\n videoNode.src = videoSourceUrl;\n videoNode.load();\n },\n };\n }\n } else {\n const videoWidth = parseInt(highestQuality.width.toString(), 10);\n const videoHeight = parseInt(highestQuality.height.toString(), 10);\n const scaleFactor = getScaleFactor(\n width,\n height,\n videoWidth,\n videoHeight,\n );\n const videoScaledDimensions = getVideoDimension(\n scaleFactor,\n videoWidth,\n videoHeight,\n );\n const targetQuality = getVideoQualityBySize(\n sources,\n videoScaledDimensions,\n );\n const url = targetQuality.types.find(\n (type) => type.format === 'mp4',\n )?.uri;\n if (url) {\n const videoSourceUrl = getCompleteUrl(url, STATIC_VIDEO_URL);\n return {\n videoSourceUrl,\n patchVideoSource: (videoNode: HTMLVideoElement) => {\n videoNode.src = videoSourceUrl;\n videoNode.load();\n },\n };\n }\n }\n }\n if (hasAbsoluteUri) {\n return {\n videoSourceUrl: uri,\n patchVideoSource: (videoNode: HTMLVideoElement) => {\n videoNode.src = uri;\n videoNode.load();\n },\n };\n }\n return {\n videoSourceUrl: '',\n patchVideoSource: () => {},\n };\n}\n"],"mappings":";;;;;;;;AAEA,MAAMA,gBAAgB,GAAG,8BAA8B;AACvD,MAAMC,yBAAyB,GAAG,wBAAwB;AAE1D,MAAMC,aAAa,GAAIC,GAAW,IAChCA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,UAAU,CAAC;AAElD,SAASC,aAAaA,CAACC,OAAsB,EAAE;EACpD,OAAOA,OAAO,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,KAAK,GAAGF,CAAC,CAACG,MAAM,GAAGF,CAAC,CAACC,KAAK,GAAGD,CAAC,CAACE,MAAM,CAAC;AACxE;AAEA,SAASC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,OAAO;MACLa,cAAc,EAAEnB,GAAG;MACnBoB,gBAAgB,EAAG9B,SAA2B,IAAK;QACjDA,SAAS,CAACoD,GAAG,GAAG1C,GAAG;QACnBV,SAAS,CAACqD,IAAI,CAAC,CAAC;MAClB;IACF,CAAC;EACH;EACA,OAAO;IACLxB,cAAc,EAAE,EAAE;IAClBC,gBAAgB,EAAEA,CAAA,KAAM,CAAC;EAC3B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _utils = require("./utils");
|
|
6
|
+
var _default = exports.default = {
|
|
7
|
+
/**
|
|
8
|
+
* @param {HTMLVideoElement} videoNode
|
|
9
|
+
* @param {HTMLElement} container
|
|
10
|
+
* @param {QualityPolicy} quality
|
|
11
|
+
* @param {string} uri
|
|
12
|
+
* @param {Object[]} sources
|
|
13
|
+
* @param {Object[]} adaptiveSources
|
|
14
|
+
* @param {number} duration
|
|
15
|
+
* @param {(error: Error) => void} onError
|
|
16
|
+
* @return {{currentSrc: string, videoSourceUrl: string}}
|
|
17
|
+
*/
|
|
18
|
+
async measure(videoNode, container, quality, uri, sources, adaptiveSources, duration, onError) {
|
|
19
|
+
const {
|
|
20
|
+
videoSourceUrl,
|
|
21
|
+
patchVideoSource
|
|
22
|
+
} = await (0, _utils.getVideoSource)(container.offsetWidth, container.offsetHeight, uri, quality, sources, adaptiveSources, duration, onError);
|
|
23
|
+
const needsSrcUpdate = shouldUpdateSrc(videoNode, videoSourceUrl);
|
|
24
|
+
return {
|
|
25
|
+
needsSrcUpdate,
|
|
26
|
+
patchVideoSource
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* @param {HTMLDivElement} poster
|
|
31
|
+
* @param {HTMLVideoElement} videoNode
|
|
32
|
+
* @param {boolean} autoplay
|
|
33
|
+
* @param {boolean} needsSrcUpdate
|
|
34
|
+
* @param {string} posterEffect
|
|
35
|
+
* @param {number} playbackRate
|
|
36
|
+
* @param {(videoNode: HTMLVideoElement) => void} patchVideoSource
|
|
37
|
+
* @param {Object[]} sources
|
|
38
|
+
* @param {Object} focalPoint
|
|
39
|
+
*/
|
|
40
|
+
mutate(poster, videoNode, autoplay, needsSrcUpdate, posterEffect, playbackRate, patchVideoSource, sources, focalPoint) {
|
|
41
|
+
videoNode.toggleAttribute('autoplay', autoplay);
|
|
42
|
+
if (sources != null && sources[0]) {
|
|
43
|
+
const videoWidth = sources[0].width;
|
|
44
|
+
const videoHeight = sources[0].height;
|
|
45
|
+
const aspectRatio = videoWidth / videoHeight;
|
|
46
|
+
videoNode.style.setProperty('--aspect-ratio', aspectRatio.toString());
|
|
47
|
+
}
|
|
48
|
+
if (focalPoint) {
|
|
49
|
+
(0, _utils.setVideoFocalPoint)(videoNode, focalPoint);
|
|
50
|
+
}
|
|
51
|
+
handlePosterVisibility(needsSrcUpdate, videoNode, poster, posterEffect, autoplay);
|
|
52
|
+
if (needsSrcUpdate) {
|
|
53
|
+
patchVideoSource(videoNode);
|
|
54
|
+
}
|
|
55
|
+
videoNode.playbackRate = playbackRate;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param videoNode
|
|
61
|
+
* @param newSrcUrl
|
|
62
|
+
* @returns {*|boolean}
|
|
63
|
+
*/
|
|
64
|
+
function shouldUpdateSrc(videoNode, newSrcUrl) {
|
|
65
|
+
const hasError = videoNode.networkState === videoNode.NETWORK_NO_SOURCE;
|
|
66
|
+
const hasDiff = !videoNode.currentSrc.endsWith(newSrcUrl);
|
|
67
|
+
return Boolean(newSrcUrl && (hasDiff || hasError));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param {boolean} needsEventUpdate
|
|
73
|
+
* @param {HTMLVideoElement} videoNode
|
|
74
|
+
* @param {HTMLDivElement} posterNode
|
|
75
|
+
* @param {string} posterEffect
|
|
76
|
+
* @param {boolean} autoplay
|
|
77
|
+
*/
|
|
78
|
+
function handlePosterVisibility(needsEventUpdate, videoNode, posterNode, posterEffect, autoplay) {
|
|
79
|
+
const isPausedOrEmpty = videoNode.paused || videoNode.currentSrc === '';
|
|
80
|
+
if (needsEventUpdate && isPausedOrEmpty) {
|
|
81
|
+
videoNode.ontimeupdate = null;
|
|
82
|
+
videoNode.onseeked = null;
|
|
83
|
+
videoNode.onplay = null;
|
|
84
|
+
if (autoplay) {
|
|
85
|
+
const muteState = videoNode.muted;
|
|
86
|
+
videoNode.ontimeupdate = () => {
|
|
87
|
+
if (videoNode.currentTime > 0) {
|
|
88
|
+
videoNode.ontimeupdate = null;
|
|
89
|
+
videoNode.onseeked = () => {
|
|
90
|
+
videoNode.onseeked = null;
|
|
91
|
+
videoNode.muted = muteState;
|
|
92
|
+
removePoster(videoNode, posterNode, posterEffect);
|
|
93
|
+
};
|
|
94
|
+
videoNode.currentTime = 0;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
} else {
|
|
98
|
+
videoNode.onplay = () => {
|
|
99
|
+
videoNode.onplay = null;
|
|
100
|
+
removePoster(videoNode, posterNode, posterEffect);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Show video , hide poster
|
|
108
|
+
*
|
|
109
|
+
* @param videoNode
|
|
110
|
+
* @param posterNode
|
|
111
|
+
* @param posterEffect
|
|
112
|
+
*/
|
|
113
|
+
function removePoster(videoNode, posterNode, posterEffect) {
|
|
114
|
+
if (posterEffect === 'fade') {
|
|
115
|
+
posterNode.style.transition = 'opacity 1.6s ease-out';
|
|
116
|
+
}
|
|
117
|
+
posterNode.style.opacity = '0';
|
|
118
|
+
videoNode.style.opacity = '1';
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=videoLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_utils","require","_default","exports","default","measure","videoNode","container","quality","uri","sources","adaptiveSources","duration","onError","videoSourceUrl","patchVideoSource","getVideoSource","offsetWidth","offsetHeight","needsSrcUpdate","shouldUpdateSrc","mutate","poster","autoplay","posterEffect","playbackRate","focalPoint","toggleAttribute","videoWidth","width","videoHeight","height","aspectRatio","style","setProperty","toString","setVideoFocalPoint","handlePosterVisibility","newSrcUrl","hasError","networkState","NETWORK_NO_SOURCE","hasDiff","currentSrc","endsWith","Boolean","needsEventUpdate","posterNode","isPausedOrEmpty","paused","ontimeupdate","onseeked","onplay","muteState","muted","currentTime","removePoster","transition","opacity"],"sources":["../../../src/custom-element/videoLayout.ts"],"sourcesContent":["import type { AdaptiveVideoSource, QualityPolicy, VideoSource } from '../types';\nimport { getVideoSource, setVideoFocalPoint } from './utils';\n\nexport default {\n /**\n * @param {HTMLVideoElement} videoNode\n * @param {HTMLElement} container\n * @param {QualityPolicy} quality\n * @param {string} uri\n * @param {Object[]} sources\n * @param {Object[]} adaptiveSources\n * @param {number} duration\n * @param {(error: Error) => void} onError\n * @return {{currentSrc: string, videoSourceUrl: string}}\n */\n async measure(\n videoNode: HTMLVideoElement,\n container: HTMLElement,\n quality: QualityPolicy,\n uri: string,\n sources?: VideoSource[],\n adaptiveSources?: AdaptiveVideoSource[],\n duration?: number,\n onError?: (error: Error) => void,\n ) {\n const { videoSourceUrl, patchVideoSource } = await getVideoSource(\n container.offsetWidth,\n container.offsetHeight,\n uri,\n quality,\n sources,\n adaptiveSources,\n duration,\n onError,\n );\n const needsSrcUpdate = shouldUpdateSrc(videoNode, videoSourceUrl);\n return {\n needsSrcUpdate,\n patchVideoSource,\n };\n },\n /**\n * @param {HTMLDivElement} poster\n * @param {HTMLVideoElement} videoNode\n * @param {boolean} autoplay\n * @param {boolean} needsSrcUpdate\n * @param {string} posterEffect\n * @param {number} playbackRate\n * @param {(videoNode: HTMLVideoElement) => void} patchVideoSource\n * @param {Object[]} sources\n * @param {Object} focalPoint\n */\n mutate(\n poster: HTMLDivElement,\n videoNode: HTMLVideoElement,\n autoplay: boolean,\n needsSrcUpdate: boolean,\n posterEffect: string,\n playbackRate: number,\n patchVideoSource: (videoNode: HTMLVideoElement) => void,\n sources?: VideoSource[],\n focalPoint?: { x: number; y: number },\n ): void {\n videoNode.toggleAttribute('autoplay', autoplay);\n if (sources?.[0]) {\n const videoWidth = sources[0].width;\n const videoHeight = sources[0].height;\n const aspectRatio = videoWidth / videoHeight;\n videoNode.style.setProperty('--aspect-ratio', aspectRatio.toString());\n }\n if (focalPoint) {\n setVideoFocalPoint(videoNode, focalPoint);\n }\n\n handlePosterVisibility(\n needsSrcUpdate,\n videoNode,\n poster,\n posterEffect,\n autoplay,\n );\n\n if (needsSrcUpdate) {\n patchVideoSource(videoNode);\n }\n videoNode.playbackRate = playbackRate;\n },\n};\n\n/**\n *\n * @param videoNode\n * @param newSrcUrl\n * @returns {*|boolean}\n */\nfunction shouldUpdateSrc(\n videoNode: HTMLVideoElement,\n newSrcUrl: string,\n): boolean {\n const hasError = videoNode.networkState === videoNode.NETWORK_NO_SOURCE;\n const hasDiff = !videoNode.currentSrc.endsWith(newSrcUrl);\n return Boolean(newSrcUrl && (hasDiff || hasError));\n}\n\n/**\n *\n * @param {boolean} needsEventUpdate\n * @param {HTMLVideoElement} videoNode\n * @param {HTMLDivElement} posterNode\n * @param {string} posterEffect\n * @param {boolean} autoplay\n */\nfunction handlePosterVisibility(\n needsEventUpdate: boolean,\n videoNode: HTMLVideoElement,\n posterNode: HTMLDivElement,\n posterEffect: string,\n autoplay: boolean,\n): void {\n const isPausedOrEmpty = videoNode.paused || videoNode.currentSrc === '';\n if (needsEventUpdate && isPausedOrEmpty) {\n videoNode.ontimeupdate = null;\n videoNode.onseeked = null;\n videoNode.onplay = null;\n if (autoplay) {\n const muteState = videoNode.muted;\n videoNode.ontimeupdate = () => {\n if (videoNode.currentTime > 0) {\n videoNode.ontimeupdate = null;\n videoNode.onseeked = () => {\n videoNode.onseeked = null;\n videoNode.muted = muteState;\n removePoster(videoNode, posterNode, posterEffect);\n };\n videoNode.currentTime = 0;\n }\n };\n } else {\n videoNode.onplay = () => {\n videoNode.onplay = null;\n removePoster(videoNode, posterNode, posterEffect);\n };\n }\n }\n}\n\n/**\n * Show video , hide poster\n *\n * @param videoNode\n * @param posterNode\n * @param posterEffect\n */\nfunction removePoster(\n videoNode: HTMLVideoElement,\n posterNode: HTMLDivElement,\n posterEffect: string,\n): void {\n if (posterEffect === 'fade') {\n posterNode.style.transition = 'opacity 1.6s ease-out';\n }\n posterNode.style.opacity = '0';\n videoNode.style.opacity = '1';\n}\n"],"mappings":";;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAA6D,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE9C;EACb;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,OAAOA,CACXC,SAA2B,EAC3BC,SAAsB,EACtBC,OAAsB,EACtBC,GAAW,EACXC,OAAuB,EACvBC,eAAuC,EACvCC,QAAiB,EACjBC,OAAgC,EAChC;IACA,MAAM;MAAEC,cAAc;MAAEC;IAAiB,CAAC,GAAG,MAAM,IAAAC,qBAAc,EAC/DT,SAAS,CAACU,WAAW,EACrBV,SAAS,CAACW,YAAY,EACtBT,GAAG,EACHD,OAAO,EACPE,OAAO,EACPC,eAAe,EACfC,QAAQ,EACRC,OACF,CAAC;IACD,MAAMM,cAAc,GAAGC,eAAe,CAACd,SAAS,EAAEQ,cAAc,CAAC;IACjE,OAAO;MACLK,cAAc;MACdJ;IACF,CAAC;EACH,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,MAAMA,CACJC,MAAsB,EACtBhB,SAA2B,EAC3BiB,QAAiB,EACjBJ,cAAuB,EACvBK,YAAoB,EACpBC,YAAoB,EACpBV,gBAAuD,EACvDL,OAAuB,EACvBgB,UAAqC,EA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|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.initCustomElement = initCustomElement;
|
|
5
|
+
var _registry = require("./custom-element/registry");
|
|
6
|
+
function initCustomElement(contextWindow = null, services = {}) {
|
|
7
|
+
const actualWindow = contextWindow || window;
|
|
8
|
+
(0, _registry.init)(actualWindow, services);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=customElementInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_registry","require","initCustomElement","contextWindow","services","actualWindow","window","init"],"sources":["../../src/customElementInit.ts"],"sourcesContent":["import { init } from './custom-element/registry';\nimport { CustomElementServices } from './types';\n\nfunction initCustomElement(\n contextWindow: (Window & typeof globalThis) | null = null,\n services: CustomElementServices = {},\n) {\n const actualWindow = contextWindow || window;\n\n init(actualWindow, services);\n}\n\nexport { initCustomElement };\n"],"mappings":";;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA,SAASC,iBAAiBA,CACxBC,aAAkD,GAAG,IAAI,EACzDC,QAA+B,GAAG,CAAC,CAAC,EACpC;EACA,MAAMC,YAAY,GAAGF,aAAa,IAAIG,MAAM;EAE5C,IAAAC,cAAI,EAACF,YAAY,EAAED,QAAQ,CAAC;AAC9B","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.videoDataManifest = void 0;
|
|
5
|
+
var _schema = require("@wix/component-protocol/schema");
|
|
6
|
+
const videoDataManifest = exports.videoDataManifest = {
|
|
7
|
+
videoMedia: {
|
|
8
|
+
dataType: _schema.DATA.DATA_TYPE.video
|
|
9
|
+
},
|
|
10
|
+
qualityPolicy: {
|
|
11
|
+
dataType: _schema.DATA.DATA_TYPE.textEnum,
|
|
12
|
+
[_schema.DATA.DATA_TYPE.textEnum]: {
|
|
13
|
+
options: [{
|
|
14
|
+
value: 'PROPORTIONAL',
|
|
15
|
+
displayName: 'Proportional'
|
|
16
|
+
}, {
|
|
17
|
+
value: 'HIGHEST',
|
|
18
|
+
displayName: 'Highest'
|
|
19
|
+
}, {
|
|
20
|
+
value: 'ADAPTIVE',
|
|
21
|
+
displayName: 'Adaptive'
|
|
22
|
+
}]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
poster: {
|
|
26
|
+
dataType: _schema.DATA.DATA_TYPE.image
|
|
27
|
+
},
|
|
28
|
+
loop: {
|
|
29
|
+
dataType: _schema.DATA.DATA_TYPE.booleanValue
|
|
30
|
+
},
|
|
31
|
+
muted: {
|
|
32
|
+
dataType: _schema.DATA.DATA_TYPE.booleanValue
|
|
33
|
+
},
|
|
34
|
+
autoplay: {
|
|
35
|
+
dataType: _schema.DATA.DATA_TYPE.booleanValue
|
|
36
|
+
},
|
|
37
|
+
playbackRate: {
|
|
38
|
+
dataType: _schema.DATA.DATA_TYPE.number
|
|
39
|
+
},
|
|
40
|
+
posterEffect: {
|
|
41
|
+
dataType: _schema.DATA.DATA_TYPE.textEnum,
|
|
42
|
+
[_schema.DATA.DATA_TYPE.textEnum]: {
|
|
43
|
+
options: [{
|
|
44
|
+
value: 'FADE',
|
|
45
|
+
displayName: 'Fade'
|
|
46
|
+
}, {
|
|
47
|
+
value: 'NONE',
|
|
48
|
+
displayName: 'None'
|
|
49
|
+
}]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=dataManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_schema","require","videoDataManifest","exports","videoMedia","dataType","DATA","DATA_TYPE","video","qualityPolicy","textEnum","options","value","displayName","poster","image","loop","booleanValue","muted","autoplay","playbackRate","number","posterEffect"],"sources":["../../src/dataManifest.ts"],"sourcesContent":["import { DATA } from '@wix/component-protocol/schema';\n\nexport const videoDataManifest: Record<string, any> = {\n videoMedia: {\n dataType: DATA.DATA_TYPE.video,\n },\n qualityPolicy: {\n dataType: DATA.DATA_TYPE.textEnum,\n [DATA.DATA_TYPE.textEnum]: {\n options: [\n { value: 'PROPORTIONAL', displayName: 'Proportional' },\n { value: 'HIGHEST', displayName: 'Highest' },\n { value: 'ADAPTIVE', displayName: 'Adaptive' },\n ],\n },\n },\n poster: {\n dataType: DATA.DATA_TYPE.image,\n },\n loop: {\n dataType: DATA.DATA_TYPE.booleanValue,\n },\n muted: {\n dataType: DATA.DATA_TYPE.booleanValue,\n },\n autoplay: {\n dataType: DATA.DATA_TYPE.booleanValue,\n },\n playbackRate: {\n dataType: DATA.DATA_TYPE.number,\n },\n posterEffect: {\n dataType: DATA.DATA_TYPE.textEnum,\n [DATA.DATA_TYPE.textEnum]: {\n options: [\n { value: 'FADE', displayName: 'Fade' },\n { value: 'NONE', displayName: 'None' },\n ],\n },\n },\n};\n"],"mappings":";;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,iBAAsC,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EACpDE,UAAU,EAAE;IACVC,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACC;EAC3B,CAAC;EACDC,aAAa,EAAE;IACbJ,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACG,QAAQ;IACjC,CAACJ,YAAI,CAACC,SAAS,CAACG,QAAQ,GAAG;MACzBC,OAAO,EAAE,CACP;QAAEC,KAAK,EAAE,cAAc;QAAEC,WAAW,EAAE;MAAe,CAAC,EACtD;QAAED,KAAK,EAAE,SAAS;QAAEC,WAAW,EAAE;MAAU,CAAC,EAC5C;QAAED,KAAK,EAAE,UAAU;QAAEC,WAAW,EAAE;MAAW,CAAC;IAElD;EACF,CAAC;EACDC,MAAM,EAAE;IACNT,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACQ;EAC3B,CAAC;EACDC,IAAI,EAAE;IACJX,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACU;EAC3B,CAAC;EACDC,KAAK,EAAE;IACLb,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACU;EAC3B,CAAC;EACDE,QAAQ,EAAE;IACRd,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACU;EAC3B,CAAC;EACDG,YAAY,EAAE;IACZf,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACc;EAC3B,CAAC;EACDC,YAAY,EAAE;IACZjB,QAAQ,EAAEC,YAAI,CAACC,SAAS,CAACG,QAAQ;IACjC,CAACJ,YAAI,CAACC,SAAS,CAACG,QAAQ,GAAG;MACzBC,OAAO,EAAE,CACP;QAAEC,KAAK,EAAE,MAAM;QAAEC,WAAW,EAAE;MAAO,CAAC,EACtC;QAAED,KAAK,EAAE,MAAM;QAAEC,WAAW,EAAE;MAAO,CAAC;IAE1C;EACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/external-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/yoshi-flow-library/types\" />\n\ndeclare namespace JSX {\n interface IntrinsicElements {\n 'wow-video': any;\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
var _exportNames = {
|
|
6
|
+
Video: true,
|
|
7
|
+
initCustomElement: true,
|
|
8
|
+
videoDataManifest: true
|
|
9
|
+
};
|
|
10
|
+
var _Video = _interopRequireDefault(require("./Video"));
|
|
11
|
+
exports.Video = _Video.default;
|
|
12
|
+
var _customElementInit = require("./customElementInit");
|
|
13
|
+
exports.initCustomElement = _customElementInit.initCustomElement;
|
|
14
|
+
var _dataManifest = require("./dataManifest");
|
|
15
|
+
exports.videoDataManifest = _dataManifest.videoDataManifest;
|
|
16
|
+
var _types = require("./types");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
21
|
+
exports[key] = _types[key];
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Video","_interopRequireDefault","require","exports","Video","default","_customElementInit","initCustomElement","_dataManifest","videoDataManifest","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames"],"sources":["../../src/index.ts"],"sourcesContent":["import Video from './Video';\nimport { initCustomElement } from './customElementInit';\nimport { videoDataManifest } from './dataManifest';\n\nexport { Video, initCustomElement, videoDataManifest };\nexport * from './types';\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4BC,OAAA,CAAAC,KAAA,GAAAJ,MAAA,CAAAK,OAAA;AAC5B,IAAAC,kBAAA,GAAAJ,OAAA;AAAwDC,OAAA,CAAAI,iBAAA,GAAAD,kBAAA,CAAAC,iBAAA;AACxD,IAAAC,aAAA,GAAAN,OAAA;AAAmDC,OAAA,CAAAM,iBAAA,GAAAD,aAAA,CAAAC,iBAAA;AAGnD,IAAAC,MAAA,GAAAR,OAAA;AAAAS,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAX,OAAA,IAAAA,OAAA,CAAAW,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAX,OAAA,CAAAW,GAAA,IAAAJ,MAAA,CAAAI,GAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.Container = void 0;
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _jsxFileName = "/home/builduser/work/5a10c7a05f300a84/packages/video/dist/cjs/storybook/Container.tsx";
|
|
8
|
+
const Container = ({
|
|
9
|
+
id,
|
|
10
|
+
width,
|
|
11
|
+
height,
|
|
12
|
+
children
|
|
13
|
+
}) => {
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
15
|
+
id: id,
|
|
16
|
+
style: {
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
border: '1px solid red'
|
|
20
|
+
},
|
|
21
|
+
__self: void 0,
|
|
22
|
+
__source: {
|
|
23
|
+
fileName: _jsxFileName,
|
|
24
|
+
lineNumber: 12,
|
|
25
|
+
columnNumber: 5
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/_react.default.cloneElement(children, {
|
|
28
|
+
containerWidth: width,
|
|
29
|
+
containerHeight: height
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
exports.Container = Container;
|
|
33
|
+
//# sourceMappingURL=Container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_jsxFileName","Container","id","width","height","children","default","createElement","style","border","__self","__source","fileName","lineNumber","columnNumber","React","cloneElement","containerWidth","containerHeight","exports"],"sources":["../../../src/storybook/Container.tsx"],"sourcesContent":["import React from 'react';\n\ntype ContainerProps = React.HTMLProps<{}>;\n\nexport const Container: React.VFC<ContainerProps> = ({\n id,\n width,\n height,\n children,\n}) => {\n return (\n <div id={id} style={{ width, height, border: '1px solid red' }}>\n {React.cloneElement(children as React.ReactElement<any>, {\n containerWidth: width,\n containerHeight: height,\n })}\n </div>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,IAAAC,YAAA;AAInB,MAAMC,SAAoC,GAAGA,CAAC;EACnDC,EAAE;EACFC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,oBACER,MAAA,CAAAS,OAAA,CAAAC,aAAA;IAAKL,EAAE,EAAEA,EAAG;IAACM,KAAK,EAAE;MAAEL,KAAK;MAAEC,MAAM;MAAEK,MAAM,EAAE;IAAgB,CAAE;IAAAC,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAZ,YAAA;MAAAa,UAAA;MAAAC,YAAA;IAAA;EAAA,gBAC5DC,cAAK,CAACC,YAAY,CAACX,QAAQ,EAA6B;IACvDY,cAAc,EAAEd,KAAK;IACrBe,eAAe,EAAEd;EACnB,CAAC,CACE,CAAC;AAEV,CAAC;AAACe,OAAA,CAAAlB,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.sampleVideo = exports.argTypes = void 0;
|
|
5
|
+
const sampleVideo = exports.sampleVideo = {
|
|
6
|
+
videoMedia: {
|
|
7
|
+
sources: [{
|
|
8
|
+
quality: '1080p',
|
|
9
|
+
width: 1920,
|
|
10
|
+
height: 1080,
|
|
11
|
+
types: [{
|
|
12
|
+
format: 'mp4',
|
|
13
|
+
uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/1080p/mp4/file.mp4'
|
|
14
|
+
}]
|
|
15
|
+
}, {
|
|
16
|
+
quality: '720p',
|
|
17
|
+
width: 1280,
|
|
18
|
+
height: 720,
|
|
19
|
+
types: [{
|
|
20
|
+
format: 'mp4',
|
|
21
|
+
uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/1080p/mp4/file.mp4'
|
|
22
|
+
}]
|
|
23
|
+
}, {
|
|
24
|
+
quality: '480p',
|
|
25
|
+
width: 854,
|
|
26
|
+
height: 480,
|
|
27
|
+
types: [{
|
|
28
|
+
format: 'mp4',
|
|
29
|
+
uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/480p/mp4/file.mp4'
|
|
30
|
+
}]
|
|
31
|
+
}, {
|
|
32
|
+
quality: '360p',
|
|
33
|
+
width: 640,
|
|
34
|
+
height: 360,
|
|
35
|
+
types: [{
|
|
36
|
+
format: 'mp4',
|
|
37
|
+
uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/360p/mp4/file.mp4'
|
|
38
|
+
}]
|
|
39
|
+
}],
|
|
40
|
+
adaptiveSources: [{
|
|
41
|
+
format: 'hls',
|
|
42
|
+
uri: 'site/media/video/11062b_c1797898279949878ff9bc792dc4a79c/da01a1fc-ad34-44bc-90e8-cc9413c466e6/repackage/hls'
|
|
43
|
+
}],
|
|
44
|
+
uri: 'test-meta-id',
|
|
45
|
+
hasAudio: true,
|
|
46
|
+
fps: 30,
|
|
47
|
+
duration: 40,
|
|
48
|
+
poster: {
|
|
49
|
+
id: 'video-poster',
|
|
50
|
+
uri: '11062b_c1797898279949878ff9bc792dc4a79cf000.jpg',
|
|
51
|
+
width: 1440,
|
|
52
|
+
height: 2560,
|
|
53
|
+
name: 'video-poster.jpg',
|
|
54
|
+
alt: 'alt text'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
loop: true,
|
|
58
|
+
muted: true,
|
|
59
|
+
autoplay: true,
|
|
60
|
+
posterEffect: 'none',
|
|
61
|
+
playbackRate: 1,
|
|
62
|
+
qualityPolicy: 'proportional'
|
|
63
|
+
};
|
|
64
|
+
const argTypes = exports.argTypes = {
|
|
65
|
+
qualityPolicy: {
|
|
66
|
+
control: 'select',
|
|
67
|
+
options: ['proportional', 'adaptive', 'highest', 'none'],
|
|
68
|
+
defaultValue: 'proportional',
|
|
69
|
+
description: 'Quality policy for the video',
|
|
70
|
+
table: {
|
|
71
|
+
type: {
|
|
72
|
+
summary: 'enum'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
containerWidth: {
|
|
77
|
+
control: 'number',
|
|
78
|
+
defaultValue: 500,
|
|
79
|
+
description: 'Width in pixels of the container element',
|
|
80
|
+
table: {
|
|
81
|
+
type: {
|
|
82
|
+
summary: 'number'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
containerHeight: {
|
|
87
|
+
control: 'number',
|
|
88
|
+
defaultValue: 275,
|
|
89
|
+
description: 'Height in pixels of the container element',
|
|
90
|
+
table: {
|
|
91
|
+
type: {
|
|
92
|
+
summary: 'number'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
muted: {
|
|
97
|
+
control: 'boolean',
|
|
98
|
+
defaultValue: true,
|
|
99
|
+
description: 'Whether the video should be muted',
|
|
100
|
+
table: {
|
|
101
|
+
type: {
|
|
102
|
+
summary: 'boolean'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
loop: {
|
|
107
|
+
control: 'boolean',
|
|
108
|
+
defaultValue: true,
|
|
109
|
+
description: 'Whether the video should loop continuously',
|
|
110
|
+
table: {
|
|
111
|
+
type: {
|
|
112
|
+
summary: 'boolean'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
posterEffect: {
|
|
117
|
+
control: 'select',
|
|
118
|
+
options: [undefined, 'fade'],
|
|
119
|
+
defaultValue: undefined,
|
|
120
|
+
description: 'Effect to apply when transitioning from poster to video',
|
|
121
|
+
table: {
|
|
122
|
+
type: {
|
|
123
|
+
summary: 'string'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
playbackRate: {
|
|
128
|
+
control: 'number',
|
|
129
|
+
defaultValue: 1,
|
|
130
|
+
description: 'The playback rate of the video',
|
|
131
|
+
table: {
|
|
132
|
+
type: {
|
|
133
|
+
summary: 'number'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
autoplay: {
|
|
138
|
+
control: 'boolean',
|
|
139
|
+
defaultValue: true,
|
|
140
|
+
description: 'Whether the video should autoplay',
|
|
141
|
+
table: {
|
|
142
|
+
type: {
|
|
143
|
+
summary: 'boolean'
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
focalPointX: {
|
|
148
|
+
control: {
|
|
149
|
+
type: 'range',
|
|
150
|
+
min: 0,
|
|
151
|
+
max: 100,
|
|
152
|
+
step: 5
|
|
153
|
+
},
|
|
154
|
+
defaultValue: 50,
|
|
155
|
+
description: 'Horizontal focal point for video positioning (0 = left, 100 = right)',
|
|
156
|
+
table: {
|
|
157
|
+
type: {
|
|
158
|
+
summary: 'number'
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
focalPointY: {
|
|
163
|
+
control: {
|
|
164
|
+
type: 'range',
|
|
165
|
+
min: 0,
|
|
166
|
+
max: 100,
|
|
167
|
+
step: 5
|
|
168
|
+
},
|
|
169
|
+
defaultValue: 50,
|
|
170
|
+
description: 'Vertical focal point for video positioning (0 = top, 100 = bottom)',
|
|
171
|
+
table: {
|
|
172
|
+
type: {
|
|
173
|
+
summary: 'number'
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sampleVideo","exports","videoMedia","sources","quality","width","height","types","format","uri","adaptiveSources","hasAudio","fps","duration","poster","id","name","alt","loop","muted","autoplay","posterEffect","playbackRate","qualityPolicy","argTypes","control","options","defaultValue","description","table","type","summary","containerWidth","containerHeight","undefined","focalPointX","min","max","step","focalPointY"],"sources":["../../../src/storybook/args.ts"],"sourcesContent":["export const sampleVideo = {\n videoMedia: {\n sources: [\n {\n quality: '1080p' as const,\n width: 1920,\n height: 1080,\n types: [\n {\n format: 'mp4' as const,\n uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/1080p/mp4/file.mp4',\n },\n ],\n },\n {\n quality: '720p' as const,\n width: 1280,\n height: 720,\n types: [\n {\n format: 'mp4' as const,\n uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/1080p/mp4/file.mp4',\n },\n ],\n },\n {\n quality: '480p' as const,\n width: 854,\n height: 480,\n types: [\n {\n format: 'mp4' as const,\n uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/480p/mp4/file.mp4',\n },\n ],\n },\n {\n quality: '360p' as const,\n width: 640,\n height: 360,\n types: [\n {\n format: 'mp4' as const,\n uri: 'video/11062b_c1797898279949878ff9bc792dc4a79c/360p/mp4/file.mp4',\n },\n ],\n },\n ],\n adaptiveSources: [\n {\n format: 'hls' as const,\n uri: 'site/media/video/11062b_c1797898279949878ff9bc792dc4a79c/da01a1fc-ad34-44bc-90e8-cc9413c466e6/repackage/hls',\n },\n ],\n uri: 'test-meta-id',\n hasAudio: true,\n fps: 30,\n duration: 40,\n poster: {\n id: 'video-poster',\n uri: '11062b_c1797898279949878ff9bc792dc4a79cf000.jpg',\n width: 1440,\n height: 2560,\n name: 'video-poster.jpg',\n alt: 'alt text',\n },\n },\n loop: true,\n muted: true,\n autoplay: true,\n posterEffect: 'none',\n playbackRate: 1,\n qualityPolicy: 'proportional',\n};\n\nexport const argTypes = {\n qualityPolicy: {\n control: 'select',\n options: ['proportional', 'adaptive', 'highest', 'none'],\n defaultValue: 'proportional',\n description: 'Quality policy for the video',\n table: {\n type: {\n summary: 'enum',\n },\n },\n },\n containerWidth: {\n control: 'number',\n defaultValue: 500,\n description: 'Width in pixels of the container element',\n table: {\n type: {\n summary: 'number',\n },\n },\n },\n containerHeight: {\n control: 'number',\n defaultValue: 275,\n description: 'Height in pixels of the container element',\n table: {\n type: {\n summary: 'number',\n },\n },\n },\n muted: {\n control: 'boolean',\n defaultValue: true,\n description: 'Whether the video should be muted',\n table: {\n type: {\n summary: 'boolean',\n },\n },\n },\n loop: {\n control: 'boolean',\n defaultValue: true,\n description: 'Whether the video should loop continuously',\n table: {\n type: {\n summary: 'boolean',\n },\n },\n },\n posterEffect: {\n control: 'select',\n options: [undefined, 'fade'],\n defaultValue: undefined,\n description: 'Effect to apply when transitioning from poster to video',\n table: {\n type: {\n summary: 'string',\n },\n },\n },\n playbackRate: {\n control: 'number',\n defaultValue: 1,\n description: 'The playback rate of the video',\n table: {\n type: {\n summary: 'number',\n },\n },\n },\n autoplay: {\n control: 'boolean',\n defaultValue: true,\n description: 'Whether the video should autoplay',\n table: {\n type: {\n summary: 'boolean',\n },\n },\n },\n focalPointX: {\n control: {\n type: 'range',\n min: 0,\n max: 100,\n step: 5,\n },\n defaultValue: 50,\n description:\n 'Horizontal focal point for video positioning (0 = left, 100 = right)',\n table: {\n type: {\n summary: 'number',\n },\n },\n },\n focalPointY: {\n control: {\n type: 'range',\n min: 0,\n max: 100,\n step: 5,\n },\n defaultValue: 50,\n description:\n 'Vertical focal point for video positioning (0 = top, 100 = bottom)',\n table: {\n type: {\n summary: 'number',\n },\n },\n },\n};\n"],"mappings":";;;;AAAO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBE,UAAU,EAAE;IACVC,OAAO,EAAE,CACP;MACEC,OAAO,EAAE,OAAgB;MACzBC,KAAK,EAAE,IAAI;MACXC,MAAM,EAAE,IAAI;MACZC,KAAK,EAAE,CACL;QACEC,MAAM,EAAE,KAAc;QACtBC,GAAG,EAAE;MACP,CAAC;IAEL,CAAC,EACD;MACEL,OAAO,EAAE,MAAe;MACxBC,KAAK,EAAE,IAAI;MACXC,MAAM,EAAE,GAAG;MACXC,KAAK,EAAE,CACL;QACEC,MAAM,EAAE,KAAc;QACtBC,GAAG,EAAE;MACP,CAAC;IAEL,CAAC,EACD;MACEL,OAAO,EAAE,MAAe;MACxBC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE,GAAG;MACXC,KAAK,EAAE,CACL;QACEC,MAAM,EAAE,KAAc;QACtBC,GAAG,EAAE;MACP,CAAC;IAEL,CAAC,EACD;MACEL,OAAO,EAAE,MAAe;MACxBC,KAAK,EAAE,GAAG;MACVC,MA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