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,173 @@
|
|
|
1
|
+
import { 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 Preview_1;
|
|
20
|
+
var hasRequiredPreview;
|
|
21
|
+
|
|
22
|
+
function requirePreview () {
|
|
23
|
+
if (hasRequiredPreview) return Preview_1;
|
|
24
|
+
hasRequiredPreview = 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 Preview_exports = {};
|
|
58
|
+
__export(Preview_exports, {
|
|
59
|
+
default: () => Preview
|
|
60
|
+
});
|
|
61
|
+
Preview_1 = __toCommonJS(Preview_exports);
|
|
62
|
+
var import_react = __toESM(React__default);
|
|
63
|
+
const ICON_SIZE = "64px";
|
|
64
|
+
const cache = {};
|
|
65
|
+
class Preview extends import_react.Component {
|
|
66
|
+
constructor() {
|
|
67
|
+
super(...arguments);
|
|
68
|
+
__publicField(this, "mounted", false);
|
|
69
|
+
__publicField(this, "state", {
|
|
70
|
+
image: null
|
|
71
|
+
});
|
|
72
|
+
__publicField(this, "handleKeyPress", (e) => {
|
|
73
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
74
|
+
this.props.onClick();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
componentDidMount() {
|
|
79
|
+
this.mounted = true;
|
|
80
|
+
this.fetchImage(this.props);
|
|
81
|
+
}
|
|
82
|
+
componentDidUpdate(prevProps) {
|
|
83
|
+
const { url, light } = this.props;
|
|
84
|
+
if (prevProps.url !== url || prevProps.light !== light) {
|
|
85
|
+
this.fetchImage(this.props);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
componentWillUnmount() {
|
|
89
|
+
this.mounted = false;
|
|
90
|
+
}
|
|
91
|
+
fetchImage({ url, light, oEmbedUrl }) {
|
|
92
|
+
if (import_react.default.isValidElement(light)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (typeof light === "string") {
|
|
96
|
+
this.setState({ image: light });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (cache[url]) {
|
|
100
|
+
this.setState({ image: cache[url] });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.setState({ image: null });
|
|
104
|
+
return window.fetch(oEmbedUrl.replace("{url}", url)).then((response) => response.json()).then((data) => {
|
|
105
|
+
if (data.thumbnail_url && this.mounted) {
|
|
106
|
+
const image = data.thumbnail_url.replace("height=100", "height=480").replace("-d_295x166", "-d_640");
|
|
107
|
+
this.setState({ image });
|
|
108
|
+
cache[url] = image;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
const { light, onClick, playIcon, previewTabIndex, previewAriaLabel } = this.props;
|
|
114
|
+
const { image } = this.state;
|
|
115
|
+
const isElement = import_react.default.isValidElement(light);
|
|
116
|
+
const flexCenter = {
|
|
117
|
+
display: "flex",
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
justifyContent: "center"
|
|
120
|
+
};
|
|
121
|
+
const styles = {
|
|
122
|
+
preview: {
|
|
123
|
+
width: "100%",
|
|
124
|
+
height: "100%",
|
|
125
|
+
backgroundImage: image && !isElement ? `url(${image})` : void 0,
|
|
126
|
+
backgroundSize: "cover",
|
|
127
|
+
backgroundPosition: "center",
|
|
128
|
+
cursor: "pointer",
|
|
129
|
+
...flexCenter
|
|
130
|
+
},
|
|
131
|
+
shadow: {
|
|
132
|
+
background: "radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",
|
|
133
|
+
borderRadius: ICON_SIZE,
|
|
134
|
+
width: ICON_SIZE,
|
|
135
|
+
height: ICON_SIZE,
|
|
136
|
+
position: isElement ? "absolute" : void 0,
|
|
137
|
+
...flexCenter
|
|
138
|
+
},
|
|
139
|
+
playIcon: {
|
|
140
|
+
borderStyle: "solid",
|
|
141
|
+
borderWidth: "16px 0 16px 26px",
|
|
142
|
+
borderColor: "transparent transparent transparent white",
|
|
143
|
+
marginLeft: "7px"
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const defaultPlayIcon = /* @__PURE__ */ import_react.default.createElement("div", { style: styles.shadow, className: "react-player__shadow" }, /* @__PURE__ */ import_react.default.createElement("div", { style: styles.playIcon, className: "react-player__play-icon" }));
|
|
147
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
style: styles.preview,
|
|
151
|
+
className: "react-player__preview",
|
|
152
|
+
onClick,
|
|
153
|
+
tabIndex: previewTabIndex,
|
|
154
|
+
onKeyPress: this.handleKeyPress,
|
|
155
|
+
...previewAriaLabel ? { "aria-label": previewAriaLabel } : {}
|
|
156
|
+
},
|
|
157
|
+
isElement ? light : null,
|
|
158
|
+
playIcon || defaultPlayIcon
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return Preview_1;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
var PreviewExports = /*@__PURE__*/ requirePreview();
|
|
166
|
+
var Preview = /*@__PURE__*/getDefaultExportFromCjs(PreviewExports);
|
|
167
|
+
|
|
168
|
+
var Preview$1 = /*#__PURE__*/_mergeNamespaces({
|
|
169
|
+
__proto__: null,
|
|
170
|
+
default: Preview
|
|
171
|
+
}, [PreviewExports]);
|
|
172
|
+
|
|
173
|
+
export { Preview$1 as P };
|
|
@@ -0,0 +1,183 @@
|
|
|
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 SoundCloud_1;
|
|
22
|
+
var hasRequiredSoundCloud;
|
|
23
|
+
|
|
24
|
+
function requireSoundCloud () {
|
|
25
|
+
if (hasRequiredSoundCloud) return SoundCloud_1;
|
|
26
|
+
hasRequiredSoundCloud = 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 SoundCloud_exports = {};
|
|
60
|
+
__export(SoundCloud_exports, {
|
|
61
|
+
default: () => SoundCloud
|
|
62
|
+
});
|
|
63
|
+
SoundCloud_1 = __toCommonJS(SoundCloud_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://w.soundcloud.com/player/api.js";
|
|
68
|
+
const SDK_GLOBAL = "SC";
|
|
69
|
+
class SoundCloud extends import_react.Component {
|
|
70
|
+
constructor() {
|
|
71
|
+
super(...arguments);
|
|
72
|
+
__publicField(this, "callPlayer", import_utils.callPlayer);
|
|
73
|
+
__publicField(this, "duration", null);
|
|
74
|
+
__publicField(this, "currentTime", null);
|
|
75
|
+
__publicField(this, "fractionLoaded", null);
|
|
76
|
+
__publicField(this, "mute", () => {
|
|
77
|
+
this.setVolume(0);
|
|
78
|
+
});
|
|
79
|
+
__publicField(this, "unmute", () => {
|
|
80
|
+
if (this.props.volume !== null) {
|
|
81
|
+
this.setVolume(this.props.volume);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
__publicField(this, "ref", (iframe) => {
|
|
85
|
+
this.iframe = iframe;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
componentDidMount() {
|
|
89
|
+
this.props.onMount && this.props.onMount(this);
|
|
90
|
+
}
|
|
91
|
+
load(url, isReady) {
|
|
92
|
+
(0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((SC) => {
|
|
93
|
+
if (!this.iframe)
|
|
94
|
+
return;
|
|
95
|
+
const { PLAY, PLAY_PROGRESS, PAUSE, FINISH, ERROR } = SC.Widget.Events;
|
|
96
|
+
if (!isReady) {
|
|
97
|
+
this.player = SC.Widget(this.iframe);
|
|
98
|
+
this.player.bind(PLAY, this.props.onPlay);
|
|
99
|
+
this.player.bind(PAUSE, () => {
|
|
100
|
+
const remaining = this.duration - this.currentTime;
|
|
101
|
+
if (remaining < 0.05) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.props.onPause();
|
|
105
|
+
});
|
|
106
|
+
this.player.bind(PLAY_PROGRESS, (e) => {
|
|
107
|
+
this.currentTime = e.currentPosition / 1e3;
|
|
108
|
+
this.fractionLoaded = e.loadedProgress;
|
|
109
|
+
});
|
|
110
|
+
this.player.bind(FINISH, () => this.props.onEnded());
|
|
111
|
+
this.player.bind(ERROR, (e) => this.props.onError(e));
|
|
112
|
+
}
|
|
113
|
+
this.player.load(url, {
|
|
114
|
+
...this.props.config.options,
|
|
115
|
+
callback: () => {
|
|
116
|
+
this.player.getDuration((duration) => {
|
|
117
|
+
this.duration = duration / 1e3;
|
|
118
|
+
this.props.onReady();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
play() {
|
|
125
|
+
this.callPlayer("play");
|
|
126
|
+
}
|
|
127
|
+
pause() {
|
|
128
|
+
this.callPlayer("pause");
|
|
129
|
+
}
|
|
130
|
+
stop() {
|
|
131
|
+
}
|
|
132
|
+
seekTo(seconds, keepPlaying = true) {
|
|
133
|
+
this.callPlayer("seekTo", seconds * 1e3);
|
|
134
|
+
if (!keepPlaying) {
|
|
135
|
+
this.pause();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
setVolume(fraction) {
|
|
139
|
+
this.callPlayer("setVolume", fraction * 100);
|
|
140
|
+
}
|
|
141
|
+
getDuration() {
|
|
142
|
+
return this.duration;
|
|
143
|
+
}
|
|
144
|
+
getCurrentTime() {
|
|
145
|
+
return this.currentTime;
|
|
146
|
+
}
|
|
147
|
+
getSecondsLoaded() {
|
|
148
|
+
return this.fractionLoaded * this.duration;
|
|
149
|
+
}
|
|
150
|
+
render() {
|
|
151
|
+
const { display } = this.props;
|
|
152
|
+
const style = {
|
|
153
|
+
width: "100%",
|
|
154
|
+
height: "100%",
|
|
155
|
+
display
|
|
156
|
+
};
|
|
157
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
158
|
+
"iframe",
|
|
159
|
+
{
|
|
160
|
+
ref: this.ref,
|
|
161
|
+
src: `https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,
|
|
162
|
+
style,
|
|
163
|
+
frameBorder: 0,
|
|
164
|
+
allow: "autoplay"
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
__publicField(SoundCloud, "displayName", "SoundCloud");
|
|
170
|
+
__publicField(SoundCloud, "canPlay", import_patterns.canPlay.soundcloud);
|
|
171
|
+
__publicField(SoundCloud, "loopOnEnded", true);
|
|
172
|
+
return SoundCloud_1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var SoundCloudExports = /*@__PURE__*/ requireSoundCloud();
|
|
176
|
+
var SoundCloud = /*@__PURE__*/index.getDefaultExportFromCjs(SoundCloudExports);
|
|
177
|
+
|
|
178
|
+
var SoundCloud$1 = /*#__PURE__*/_mergeNamespaces({
|
|
179
|
+
__proto__: null,
|
|
180
|
+
default: SoundCloud
|
|
181
|
+
}, [SoundCloudExports]);
|
|
182
|
+
|
|
183
|
+
exports.SoundCloud = SoundCloud$1;
|
|
@@ -0,0 +1,181 @@
|
|
|
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 SoundCloud_1;
|
|
20
|
+
var hasRequiredSoundCloud;
|
|
21
|
+
|
|
22
|
+
function requireSoundCloud () {
|
|
23
|
+
if (hasRequiredSoundCloud) return SoundCloud_1;
|
|
24
|
+
hasRequiredSoundCloud = 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 SoundCloud_exports = {};
|
|
58
|
+
__export(SoundCloud_exports, {
|
|
59
|
+
default: () => SoundCloud
|
|
60
|
+
});
|
|
61
|
+
SoundCloud_1 = __toCommonJS(SoundCloud_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://w.soundcloud.com/player/api.js";
|
|
66
|
+
const SDK_GLOBAL = "SC";
|
|
67
|
+
class SoundCloud extends import_react.Component {
|
|
68
|
+
constructor() {
|
|
69
|
+
super(...arguments);
|
|
70
|
+
__publicField(this, "callPlayer", import_utils.callPlayer);
|
|
71
|
+
__publicField(this, "duration", null);
|
|
72
|
+
__publicField(this, "currentTime", null);
|
|
73
|
+
__publicField(this, "fractionLoaded", null);
|
|
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", (iframe) => {
|
|
83
|
+
this.iframe = iframe;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
componentDidMount() {
|
|
87
|
+
this.props.onMount && this.props.onMount(this);
|
|
88
|
+
}
|
|
89
|
+
load(url, isReady) {
|
|
90
|
+
(0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((SC) => {
|
|
91
|
+
if (!this.iframe)
|
|
92
|
+
return;
|
|
93
|
+
const { PLAY, PLAY_PROGRESS, PAUSE, FINISH, ERROR } = SC.Widget.Events;
|
|
94
|
+
if (!isReady) {
|
|
95
|
+
this.player = SC.Widget(this.iframe);
|
|
96
|
+
this.player.bind(PLAY, this.props.onPlay);
|
|
97
|
+
this.player.bind(PAUSE, () => {
|
|
98
|
+
const remaining = this.duration - this.currentTime;
|
|
99
|
+
if (remaining < 0.05) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.props.onPause();
|
|
103
|
+
});
|
|
104
|
+
this.player.bind(PLAY_PROGRESS, (e) => {
|
|
105
|
+
this.currentTime = e.currentPosition / 1e3;
|
|
106
|
+
this.fractionLoaded = e.loadedProgress;
|
|
107
|
+
});
|
|
108
|
+
this.player.bind(FINISH, () => this.props.onEnded());
|
|
109
|
+
this.player.bind(ERROR, (e) => this.props.onError(e));
|
|
110
|
+
}
|
|
111
|
+
this.player.load(url, {
|
|
112
|
+
...this.props.config.options,
|
|
113
|
+
callback: () => {
|
|
114
|
+
this.player.getDuration((duration) => {
|
|
115
|
+
this.duration = duration / 1e3;
|
|
116
|
+
this.props.onReady();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
play() {
|
|
123
|
+
this.callPlayer("play");
|
|
124
|
+
}
|
|
125
|
+
pause() {
|
|
126
|
+
this.callPlayer("pause");
|
|
127
|
+
}
|
|
128
|
+
stop() {
|
|
129
|
+
}
|
|
130
|
+
seekTo(seconds, keepPlaying = true) {
|
|
131
|
+
this.callPlayer("seekTo", seconds * 1e3);
|
|
132
|
+
if (!keepPlaying) {
|
|
133
|
+
this.pause();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
setVolume(fraction) {
|
|
137
|
+
this.callPlayer("setVolume", fraction * 100);
|
|
138
|
+
}
|
|
139
|
+
getDuration() {
|
|
140
|
+
return this.duration;
|
|
141
|
+
}
|
|
142
|
+
getCurrentTime() {
|
|
143
|
+
return this.currentTime;
|
|
144
|
+
}
|
|
145
|
+
getSecondsLoaded() {
|
|
146
|
+
return this.fractionLoaded * this.duration;
|
|
147
|
+
}
|
|
148
|
+
render() {
|
|
149
|
+
const { display } = this.props;
|
|
150
|
+
const style = {
|
|
151
|
+
width: "100%",
|
|
152
|
+
height: "100%",
|
|
153
|
+
display
|
|
154
|
+
};
|
|
155
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
156
|
+
"iframe",
|
|
157
|
+
{
|
|
158
|
+
ref: this.ref,
|
|
159
|
+
src: `https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,
|
|
160
|
+
style,
|
|
161
|
+
frameBorder: 0,
|
|
162
|
+
allow: "autoplay"
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
__publicField(SoundCloud, "displayName", "SoundCloud");
|
|
168
|
+
__publicField(SoundCloud, "canPlay", import_patterns.canPlay.soundcloud);
|
|
169
|
+
__publicField(SoundCloud, "loopOnEnded", true);
|
|
170
|
+
return SoundCloud_1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var SoundCloudExports = /*@__PURE__*/ requireSoundCloud();
|
|
174
|
+
var SoundCloud = /*@__PURE__*/getDefaultExportFromCjs(SoundCloudExports);
|
|
175
|
+
|
|
176
|
+
var SoundCloud$1 = /*#__PURE__*/_mergeNamespaces({
|
|
177
|
+
__proto__: null,
|
|
178
|
+
default: SoundCloud
|
|
179
|
+
}, [SoundCloudExports]);
|
|
180
|
+
|
|
181
|
+
export { SoundCloud$1 as S };
|