suada-components 1.8.0 → 1.9.1
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/dist/{components/DailyMotion-SZKPSpD1.js → DailyMotion-B-Q4fBEb.js} +1 -1
- package/dist/{components/DailyMotion-jrl4eEA1.esm.js → DailyMotion-BAvo3Toe.esm.js} +1 -1
- package/dist/{components/Facebook-Ha24RKIX.esm.js → Facebook-C8GOujDt.esm.js} +1 -1
- package/dist/{components/Facebook-DS0ye_bL.js → Facebook-CASik-P5.js} +1 -1
- package/dist/{components/FilePlayer-D-n083nK.esm.js → FilePlayer-BOZIvaDy.esm.js} +1 -1
- package/dist/{components/FilePlayer-B4_DDZXQ.js → FilePlayer-CQ80KWY2.js} +1 -1
- package/dist/{components/Kaltura-BlDrsjbp.esm.js → Kaltura-B12Xdl6X.esm.js} +1 -1
- package/dist/{components/Kaltura-DAMolg_c.js → Kaltura-nYc5k7UB.js} +1 -1
- package/dist/{components/Mixcloud-C1z9BVJ8.js → Mixcloud-DGQnlDAK.js} +1 -1
- package/dist/{components/Mixcloud-B5AIgf8e.esm.js → Mixcloud-JfeQIOki.esm.js} +1 -1
- package/dist/{components/Mux-f77ctQXE.esm.js → Mux-BHWzpAR-.esm.js} +1 -1
- package/dist/{components/Mux-Bgsc5vvM.js → Mux-CiKZc8gj.js} +1 -1
- package/dist/{components/Preview-DhMMn7e2.esm.js → Preview-DSovY9gr.esm.js} +1 -1
- package/dist/{components/Preview-CKXk6Axz.js → Preview-DvZKrgm5.js} +1 -1
- package/dist/{components/SoundCloud-DHLHmaaB.js → SoundCloud-Di7z3nmP.js} +1 -1
- package/dist/{components/SoundCloud-DyYFhGe5.esm.js → SoundCloud-j_R0lK8D.esm.js} +1 -1
- package/dist/{components/Streamable-BBygdIqb.esm.js → Streamable-CRhXZIKP.esm.js} +1 -1
- package/dist/{components/Streamable-BDhbB3m3.js → Streamable-CV1mgzRv.js} +1 -1
- package/dist/{components/Twitch-CAbFCb5f.esm.js → Twitch-6icfp-ZE.esm.js} +1 -1
- package/dist/{components/Twitch-ZG7WuoXD.js → Twitch-Dj66vkCD.js} +1 -1
- package/dist/{components/Vidyard-BsU5Ayr6.esm.js → Vidyard--KX47pZ0.esm.js} +1 -1
- package/dist/{components/Vidyard-CkSCnLg5.js → Vidyard-B-qmApe9.js} +1 -1
- package/dist/{components/Vimeo-4uslT7bX.esm.js → Vimeo-Ba9C6utC.esm.js} +1 -1
- package/dist/{components/Vimeo-DKpnTiZ8.js → Vimeo-DePzl7Sn.js} +1 -1
- package/dist/{components/Wistia-DKdMEz2a.js → Wistia-CXYB3Yus.js} +1 -1
- package/dist/{components/Wistia-BxvIPVO7.esm.js → Wistia-DWJcdcY2.esm.js} +1 -1
- package/dist/{components/YouTube-Cd4b1iuA.esm.js → YouTube-DdBVPxzz.esm.js} +1 -1
- package/dist/{components/YouTube-JSWV2_hs.js → YouTube-vwMoW93C.js} +1 -1
- package/dist/components/CourseCard/CourseCard.styles.d.ts +1 -1
- package/dist/components/DailyMotion-Cr_8IZRR.js +180 -0
- package/dist/components/DailyMotion-D2n1NDDi.esm.js +178 -0
- package/dist/components/Facebook-CDrTA2_L.esm.js +179 -0
- package/dist/components/Facebook-YxZce26V.js +181 -0
- package/dist/components/FilePlayer-BzkVMbQ8.esm.js +408 -0
- package/dist/components/FilePlayer-DqqTufgX.js +410 -0
- package/dist/components/Kaltura-B0UZLr6g.esm.js +176 -0
- package/dist/components/Kaltura-krSxvIBr.js +178 -0
- package/dist/components/Mixcloud-BCT5e47d.js +166 -0
- package/dist/components/Mixcloud-D9qk3D6i.esm.js +164 -0
- package/dist/components/Mux-BZleoaJh.esm.js +264 -0
- package/dist/components/Mux-D_si09u2.js +266 -0
- package/dist/components/Preview-CmduMeEZ.js +175 -0
- package/dist/components/Preview-DQLbQ8_C.esm.js +173 -0
- package/dist/components/SoundCloud-BHgTfaW7.js +183 -0
- package/dist/components/SoundCloud-BgnX8kOF.esm.js +181 -0
- package/dist/components/Streamable-DTAzjVwd.js +176 -0
- package/dist/components/Streamable-DbRbUflP.esm.js +174 -0
- package/dist/components/Twitch-CXOhay4a.esm.js +168 -0
- package/dist/components/Twitch-CnEk-l9R.js +170 -0
- package/dist/components/VideoPlayer/PiPContext.d.ts +8 -0
- package/dist/components/VideoPlayer/PiPContext.js +149 -0
- package/dist/components/VideoPlayer/PiPContext.js.map +1 -0
- package/dist/components/VideoPlayer/PiPContext.types.d.ts +16 -0
- package/dist/components/VideoPlayer/PiPContext.types.js +2 -0
- package/dist/components/VideoPlayer/PiPContext.types.js.map +1 -0
- package/dist/components/VideoPlayer/usePiP.d.ts +2 -0
- package/dist/components/VideoPlayer/usePiP.js +10 -0
- package/dist/components/VideoPlayer/usePiP.js.map +1 -0
- package/dist/components/Vidyard-Cn_LcGwi.js +174 -0
- package/dist/components/Vidyard-YcZH6kkW.esm.js +172 -0
- package/dist/components/Vimeo-BUVxWt7t.js +215 -0
- package/dist/components/Vimeo-Cv0qx3aR.esm.js +213 -0
- package/dist/components/Wistia-COWrV8QC.js +190 -0
- package/dist/components/Wistia-PneZ48dn.esm.js +188 -0
- package/dist/components/YouTube-BUyvzJQw.esm.js +258 -0
- package/dist/components/YouTube-DeQdfkWm.js +260 -0
- package/dist/components/components/CourseCard/CourseCard.styles.d.ts +1 -1
- package/dist/components/components/VideoPlayer/PiPContext.d.ts +8 -0
- package/dist/components/components/VideoPlayer/PiPContext.types.d.ts +16 -0
- package/dist/components/components/VideoPlayer/usePiP.d.ts +2 -0
- package/dist/components/components/index.d.ts +2 -0
- package/dist/components/{index-XiB9Yp2-.js → index-Bs-XxxV4.js} +141 -14
- package/dist/components/{index-BTR541gv.esm.js → index-C4Mk2H3N.esm.js} +140 -15
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/icons/components/CourseCard/CourseCard.styles.d.ts +1 -1
- package/dist/icons/components/VideoPlayer/PiPContext.d.ts +8 -0
- package/dist/icons/components/VideoPlayer/PiPContext.types.d.ts +16 -0
- package/dist/icons/components/VideoPlayer/usePiP.d.ts +2 -0
- package/dist/icons/components/index.d.ts +2 -0
- package/dist/index-Bp-idbg5.esm.js +94907 -0
- package/dist/index-CSj9NYxJ.js +95129 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +3 -3
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
+
import { createContext, useState, useCallback, useRef, useEffect } from 'react';
|
|
50
|
+
export var PiPContext = createContext(undefined);
|
|
51
|
+
export var PiPProvider = function (_a) {
|
|
52
|
+
var children = _a.children;
|
|
53
|
+
var _b = useState(false), isPiPActive = _b[0], setIsPiPActive = _b[1];
|
|
54
|
+
var _c = useState(null), pipVideoState = _c[0], setPipVideoState = _c[1];
|
|
55
|
+
var videoElementRef = useRef(null);
|
|
56
|
+
var updateVideoState = useCallback(function (state) {
|
|
57
|
+
setPipVideoState(function (prev) { return prev ? __assign(__assign({}, prev), state) : null; });
|
|
58
|
+
}, []);
|
|
59
|
+
var registerVideoElement = useCallback(function (element) {
|
|
60
|
+
videoElementRef.current = element;
|
|
61
|
+
}, []);
|
|
62
|
+
var unregisterVideoElement = useCallback(function () {
|
|
63
|
+
videoElementRef.current = null;
|
|
64
|
+
}, []);
|
|
65
|
+
var enterPiP = useCallback(function (videoElement, videoState) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var error_1;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
if (!document.pictureInPictureEnabled) {
|
|
71
|
+
console.warn('Picture-in-Picture is not supported in this browser');
|
|
72
|
+
return [2 /*return*/, false];
|
|
73
|
+
}
|
|
74
|
+
if (document.pictureInPictureElement) {
|
|
75
|
+
console.warn('Another video is already in Picture-in-Picture mode');
|
|
76
|
+
return [2 /*return*/, false];
|
|
77
|
+
}
|
|
78
|
+
_a.label = 1;
|
|
79
|
+
case 1:
|
|
80
|
+
_a.trys.push([1, 5, , 6]);
|
|
81
|
+
// Store video state
|
|
82
|
+
setPipVideoState(videoState);
|
|
83
|
+
videoElementRef.current = videoElement;
|
|
84
|
+
if (!(videoElement.paused && videoState.isPlaying)) return [3 /*break*/, 3];
|
|
85
|
+
return [4 /*yield*/, videoElement.play()];
|
|
86
|
+
case 2:
|
|
87
|
+
_a.sent();
|
|
88
|
+
_a.label = 3;
|
|
89
|
+
case 3: return [4 /*yield*/, videoElement.requestPictureInPicture()];
|
|
90
|
+
case 4:
|
|
91
|
+
_a.sent();
|
|
92
|
+
return [2 /*return*/, true];
|
|
93
|
+
case 5:
|
|
94
|
+
error_1 = _a.sent();
|
|
95
|
+
console.error('Failed to enter picture-in-picture:', error_1);
|
|
96
|
+
return [2 /*return*/, false];
|
|
97
|
+
case 6: return [2 /*return*/];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}); }, []);
|
|
101
|
+
var exitPiP = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
+
var error_2;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
_a.trys.push([0, 3, , 4]);
|
|
107
|
+
if (!document.pictureInPictureElement) return [3 /*break*/, 2];
|
|
108
|
+
return [4 /*yield*/, document.exitPictureInPicture()];
|
|
109
|
+
case 1:
|
|
110
|
+
_a.sent();
|
|
111
|
+
_a.label = 2;
|
|
112
|
+
case 2: return [2 /*return*/, true];
|
|
113
|
+
case 3:
|
|
114
|
+
error_2 = _a.sent();
|
|
115
|
+
console.error('Failed to exit picture-in-picture:', error_2);
|
|
116
|
+
return [2 /*return*/, false];
|
|
117
|
+
case 4: return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}); }, []);
|
|
121
|
+
// Listen for PiP events
|
|
122
|
+
useEffect(function () {
|
|
123
|
+
var handlePiPEnter = function () {
|
|
124
|
+
setIsPiPActive(true);
|
|
125
|
+
};
|
|
126
|
+
var handlePiPLeave = function () {
|
|
127
|
+
setIsPiPActive(false);
|
|
128
|
+
// Keep the video state for potential restoration
|
|
129
|
+
// but don't clear it immediately
|
|
130
|
+
};
|
|
131
|
+
document.addEventListener('enterpictureinpicture', handlePiPEnter);
|
|
132
|
+
document.addEventListener('leavepictureinpicture', handlePiPLeave);
|
|
133
|
+
return function () {
|
|
134
|
+
document.removeEventListener('enterpictureinpicture', handlePiPEnter);
|
|
135
|
+
document.removeEventListener('leavepictureinpicture', handlePiPLeave);
|
|
136
|
+
};
|
|
137
|
+
}, []);
|
|
138
|
+
var value = {
|
|
139
|
+
isPiPActive: isPiPActive,
|
|
140
|
+
pipVideoState: pipVideoState,
|
|
141
|
+
enterPiP: enterPiP,
|
|
142
|
+
exitPiP: exitPiP,
|
|
143
|
+
updateVideoState: updateVideoState,
|
|
144
|
+
registerVideoElement: registerVideoElement,
|
|
145
|
+
unregisterVideoElement: unregisterVideoElement,
|
|
146
|
+
};
|
|
147
|
+
return _jsx(PiPContext.Provider, { value: value, children: children });
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=PiPContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiPContext.js","sourceRoot":"","sources":["../../../src/components/VideoPlayer/PiPContext.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PiPVideoState {
|
|
2
|
+
url: string;
|
|
3
|
+
currentTime: number;
|
|
4
|
+
isPlaying: boolean;
|
|
5
|
+
volume: number;
|
|
6
|
+
muted: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface PiPContextType {
|
|
9
|
+
isPiPActive: boolean;
|
|
10
|
+
pipVideoState: PiPVideoState | null;
|
|
11
|
+
enterPiP: (videoElement: HTMLVideoElement, videoState: PiPVideoState) => Promise<boolean>;
|
|
12
|
+
exitPiP: () => Promise<boolean>;
|
|
13
|
+
updateVideoState: (state: Partial<PiPVideoState>) => void;
|
|
14
|
+
registerVideoElement: (element: HTMLVideoElement) => void;
|
|
15
|
+
unregisterVideoElement: () => void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiPContext.types.js","sourceRoot":"","sources":["../../../src/components/VideoPlayer/PiPContext.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { PiPContext } from './PiPContext';
|
|
3
|
+
export var usePiP = function () {
|
|
4
|
+
var context = useContext(PiPContext);
|
|
5
|
+
if (context === undefined) {
|
|
6
|
+
throw new Error('usePiP must be used within a PiPProvider');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=usePiP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePiP.js","sourceRoot":"","sources":["../../../src/components/VideoPlayer/usePiP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,MAAM,CAAC,IAAM,MAAM,GAAG;IACpB,IAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC7D,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Bs-XxxV4.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function _mergeNamespaces(n, m) {
|
|
7
|
+
m.forEach(function (e) {
|
|
8
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default' && !(k in n)) {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
return Object.freeze(n);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var Vidyard_1;
|
|
22
|
+
var hasRequiredVidyard;
|
|
23
|
+
|
|
24
|
+
function requireVidyard () {
|
|
25
|
+
if (hasRequiredVidyard) return Vidyard_1;
|
|
26
|
+
hasRequiredVidyard = 1;
|
|
27
|
+
var __create = Object.create;
|
|
28
|
+
var __defProp = Object.defineProperty;
|
|
29
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
30
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
31
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
32
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
33
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
34
|
+
var __export = (target, all) => {
|
|
35
|
+
for (var name in all)
|
|
36
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
37
|
+
};
|
|
38
|
+
var __copyProps = (to, from, except, desc) => {
|
|
39
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
40
|
+
for (let key of __getOwnPropNames(from))
|
|
41
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
42
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
43
|
+
}
|
|
44
|
+
return to;
|
|
45
|
+
};
|
|
46
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
47
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
48
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
49
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
50
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
51
|
+
!mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
52
|
+
mod
|
|
53
|
+
));
|
|
54
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
55
|
+
var __publicField = (obj, key, value) => {
|
|
56
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
57
|
+
return value;
|
|
58
|
+
};
|
|
59
|
+
var Vidyard_exports = {};
|
|
60
|
+
__export(Vidyard_exports, {
|
|
61
|
+
default: () => Vidyard
|
|
62
|
+
});
|
|
63
|
+
Vidyard_1 = __toCommonJS(Vidyard_exports);
|
|
64
|
+
var import_react = __toESM(React);
|
|
65
|
+
var import_utils = /*@__PURE__*/ index.requireUtils();
|
|
66
|
+
var import_patterns = /*@__PURE__*/ index.requirePatterns();
|
|
67
|
+
const SDK_URL = "https://play.vidyard.com/embed/v4.js";
|
|
68
|
+
const SDK_GLOBAL = "VidyardV4";
|
|
69
|
+
const SDK_GLOBAL_READY = "onVidyardAPI";
|
|
70
|
+
class Vidyard extends import_react.Component {
|
|
71
|
+
constructor() {
|
|
72
|
+
super(...arguments);
|
|
73
|
+
__publicField(this, "callPlayer", import_utils.callPlayer);
|
|
74
|
+
__publicField(this, "mute", () => {
|
|
75
|
+
this.setVolume(0);
|
|
76
|
+
});
|
|
77
|
+
__publicField(this, "unmute", () => {
|
|
78
|
+
if (this.props.volume !== null) {
|
|
79
|
+
this.setVolume(this.props.volume);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
__publicField(this, "ref", (container) => {
|
|
83
|
+
this.container = container;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
componentDidMount() {
|
|
87
|
+
this.props.onMount && this.props.onMount(this);
|
|
88
|
+
}
|
|
89
|
+
load(url) {
|
|
90
|
+
const { playing, config, onError, onDuration } = this.props;
|
|
91
|
+
const id = url && url.match(import_patterns.MATCH_URL_VIDYARD)[1];
|
|
92
|
+
if (this.player) {
|
|
93
|
+
this.stop();
|
|
94
|
+
}
|
|
95
|
+
(0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then((Vidyard2) => {
|
|
96
|
+
if (!this.container)
|
|
97
|
+
return;
|
|
98
|
+
Vidyard2.api.addReadyListener((data, player) => {
|
|
99
|
+
if (this.player) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.player = player;
|
|
103
|
+
this.player.on("ready", this.props.onReady);
|
|
104
|
+
this.player.on("play", this.props.onPlay);
|
|
105
|
+
this.player.on("pause", this.props.onPause);
|
|
106
|
+
this.player.on("seek", this.props.onSeek);
|
|
107
|
+
this.player.on("playerComplete", this.props.onEnded);
|
|
108
|
+
}, id);
|
|
109
|
+
Vidyard2.api.renderPlayer({
|
|
110
|
+
uuid: id,
|
|
111
|
+
container: this.container,
|
|
112
|
+
autoplay: playing ? 1 : 0,
|
|
113
|
+
...config.options
|
|
114
|
+
});
|
|
115
|
+
Vidyard2.api.getPlayerMetadata(id).then((meta) => {
|
|
116
|
+
this.duration = meta.length_in_seconds;
|
|
117
|
+
onDuration(meta.length_in_seconds);
|
|
118
|
+
});
|
|
119
|
+
}, onError);
|
|
120
|
+
}
|
|
121
|
+
play() {
|
|
122
|
+
this.callPlayer("play");
|
|
123
|
+
}
|
|
124
|
+
pause() {
|
|
125
|
+
this.callPlayer("pause");
|
|
126
|
+
}
|
|
127
|
+
stop() {
|
|
128
|
+
window.VidyardV4.api.destroyPlayer(this.player);
|
|
129
|
+
}
|
|
130
|
+
seekTo(amount, keepPlaying = true) {
|
|
131
|
+
this.callPlayer("seek", amount);
|
|
132
|
+
if (!keepPlaying) {
|
|
133
|
+
this.pause();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
setVolume(fraction) {
|
|
137
|
+
this.callPlayer("setVolume", fraction);
|
|
138
|
+
}
|
|
139
|
+
setPlaybackRate(rate) {
|
|
140
|
+
this.callPlayer("setPlaybackSpeed", rate);
|
|
141
|
+
}
|
|
142
|
+
getDuration() {
|
|
143
|
+
return this.duration;
|
|
144
|
+
}
|
|
145
|
+
getCurrentTime() {
|
|
146
|
+
return this.callPlayer("currentTime");
|
|
147
|
+
}
|
|
148
|
+
getSecondsLoaded() {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
render() {
|
|
152
|
+
const { display } = this.props;
|
|
153
|
+
const style = {
|
|
154
|
+
width: "100%",
|
|
155
|
+
height: "100%",
|
|
156
|
+
display
|
|
157
|
+
};
|
|
158
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { style }, /* @__PURE__ */ import_react.default.createElement("div", { ref: this.ref }));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
__publicField(Vidyard, "displayName", "Vidyard");
|
|
162
|
+
__publicField(Vidyard, "canPlay", import_patterns.canPlay.vidyard);
|
|
163
|
+
return Vidyard_1;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var VidyardExports = /*@__PURE__*/ requireVidyard();
|
|
167
|
+
var Vidyard = /*@__PURE__*/index.getDefaultExportFromCjs(VidyardExports);
|
|
168
|
+
|
|
169
|
+
var Vidyard$1 = /*#__PURE__*/_mergeNamespaces({
|
|
170
|
+
__proto__: null,
|
|
171
|
+
default: Vidyard
|
|
172
|
+
}, [VidyardExports]);
|
|
173
|
+
|
|
174
|
+
exports.Vidyard = Vidyard$1;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { r as requireUtils, a as requirePatterns, g as getDefaultExportFromCjs } from './index-C4Mk2H3N.esm.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
function _mergeNamespaces(n, m) {
|
|
5
|
+
m.forEach(function (e) {
|
|
6
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
7
|
+
if (k !== 'default' && !(k in n)) {
|
|
8
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
9
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return e[k]; }
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
return Object.freeze(n);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var Vidyard_1;
|
|
20
|
+
var hasRequiredVidyard;
|
|
21
|
+
|
|
22
|
+
function requireVidyard () {
|
|
23
|
+
if (hasRequiredVidyard) return Vidyard_1;
|
|
24
|
+
hasRequiredVidyard = 1;
|
|
25
|
+
var __create = Object.create;
|
|
26
|
+
var __defProp = Object.defineProperty;
|
|
27
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
28
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
29
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
30
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
31
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
32
|
+
var __export = (target, all) => {
|
|
33
|
+
for (var name in all)
|
|
34
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
35
|
+
};
|
|
36
|
+
var __copyProps = (to, from, except, desc) => {
|
|
37
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
38
|
+
for (let key of __getOwnPropNames(from))
|
|
39
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
40
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
41
|
+
}
|
|
42
|
+
return to;
|
|
43
|
+
};
|
|
44
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
45
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
46
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
47
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
48
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
49
|
+
!mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
50
|
+
mod
|
|
51
|
+
));
|
|
52
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
53
|
+
var __publicField = (obj, key, value) => {
|
|
54
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
55
|
+
return value;
|
|
56
|
+
};
|
|
57
|
+
var Vidyard_exports = {};
|
|
58
|
+
__export(Vidyard_exports, {
|
|
59
|
+
default: () => Vidyard
|
|
60
|
+
});
|
|
61
|
+
Vidyard_1 = __toCommonJS(Vidyard_exports);
|
|
62
|
+
var import_react = __toESM(React__default);
|
|
63
|
+
var import_utils = /*@__PURE__*/ requireUtils();
|
|
64
|
+
var import_patterns = /*@__PURE__*/ requirePatterns();
|
|
65
|
+
const SDK_URL = "https://play.vidyard.com/embed/v4.js";
|
|
66
|
+
const SDK_GLOBAL = "VidyardV4";
|
|
67
|
+
const SDK_GLOBAL_READY = "onVidyardAPI";
|
|
68
|
+
class Vidyard extends import_react.Component {
|
|
69
|
+
constructor() {
|
|
70
|
+
super(...arguments);
|
|
71
|
+
__publicField(this, "callPlayer", import_utils.callPlayer);
|
|
72
|
+
__publicField(this, "mute", () => {
|
|
73
|
+
this.setVolume(0);
|
|
74
|
+
});
|
|
75
|
+
__publicField(this, "unmute", () => {
|
|
76
|
+
if (this.props.volume !== null) {
|
|
77
|
+
this.setVolume(this.props.volume);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
__publicField(this, "ref", (container) => {
|
|
81
|
+
this.container = container;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
componentDidMount() {
|
|
85
|
+
this.props.onMount && this.props.onMount(this);
|
|
86
|
+
}
|
|
87
|
+
load(url) {
|
|
88
|
+
const { playing, config, onError, onDuration } = this.props;
|
|
89
|
+
const id = url && url.match(import_patterns.MATCH_URL_VIDYARD)[1];
|
|
90
|
+
if (this.player) {
|
|
91
|
+
this.stop();
|
|
92
|
+
}
|
|
93
|
+
(0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then((Vidyard2) => {
|
|
94
|
+
if (!this.container)
|
|
95
|
+
return;
|
|
96
|
+
Vidyard2.api.addReadyListener((data, player) => {
|
|
97
|
+
if (this.player) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.player = player;
|
|
101
|
+
this.player.on("ready", this.props.onReady);
|
|
102
|
+
this.player.on("play", this.props.onPlay);
|
|
103
|
+
this.player.on("pause", this.props.onPause);
|
|
104
|
+
this.player.on("seek", this.props.onSeek);
|
|
105
|
+
this.player.on("playerComplete", this.props.onEnded);
|
|
106
|
+
}, id);
|
|
107
|
+
Vidyard2.api.renderPlayer({
|
|
108
|
+
uuid: id,
|
|
109
|
+
container: this.container,
|
|
110
|
+
autoplay: playing ? 1 : 0,
|
|
111
|
+
...config.options
|
|
112
|
+
});
|
|
113
|
+
Vidyard2.api.getPlayerMetadata(id).then((meta) => {
|
|
114
|
+
this.duration = meta.length_in_seconds;
|
|
115
|
+
onDuration(meta.length_in_seconds);
|
|
116
|
+
});
|
|
117
|
+
}, onError);
|
|
118
|
+
}
|
|
119
|
+
play() {
|
|
120
|
+
this.callPlayer("play");
|
|
121
|
+
}
|
|
122
|
+
pause() {
|
|
123
|
+
this.callPlayer("pause");
|
|
124
|
+
}
|
|
125
|
+
stop() {
|
|
126
|
+
window.VidyardV4.api.destroyPlayer(this.player);
|
|
127
|
+
}
|
|
128
|
+
seekTo(amount, keepPlaying = true) {
|
|
129
|
+
this.callPlayer("seek", amount);
|
|
130
|
+
if (!keepPlaying) {
|
|
131
|
+
this.pause();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
setVolume(fraction) {
|
|
135
|
+
this.callPlayer("setVolume", fraction);
|
|
136
|
+
}
|
|
137
|
+
setPlaybackRate(rate) {
|
|
138
|
+
this.callPlayer("setPlaybackSpeed", rate);
|
|
139
|
+
}
|
|
140
|
+
getDuration() {
|
|
141
|
+
return this.duration;
|
|
142
|
+
}
|
|
143
|
+
getCurrentTime() {
|
|
144
|
+
return this.callPlayer("currentTime");
|
|
145
|
+
}
|
|
146
|
+
getSecondsLoaded() {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
render() {
|
|
150
|
+
const { display } = this.props;
|
|
151
|
+
const style = {
|
|
152
|
+
width: "100%",
|
|
153
|
+
height: "100%",
|
|
154
|
+
display
|
|
155
|
+
};
|
|
156
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { style }, /* @__PURE__ */ import_react.default.createElement("div", { ref: this.ref }));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
__publicField(Vidyard, "displayName", "Vidyard");
|
|
160
|
+
__publicField(Vidyard, "canPlay", import_patterns.canPlay.vidyard);
|
|
161
|
+
return Vidyard_1;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var VidyardExports = /*@__PURE__*/ requireVidyard();
|
|
165
|
+
var Vidyard = /*@__PURE__*/getDefaultExportFromCjs(VidyardExports);
|
|
166
|
+
|
|
167
|
+
var Vidyard$1 = /*#__PURE__*/_mergeNamespaces({
|
|
168
|
+
__proto__: null,
|
|
169
|
+
default: Vidyard
|
|
170
|
+
}, [VidyardExports]);
|
|
171
|
+
|
|
172
|
+
export { Vidyard$1 as V };
|