suada-components 1.9.0 → 1.10.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/dist/{components/DailyMotion-B7yDPBbg.js → DailyMotion-DacNkqsi.js} +1 -1
- package/dist/{components/DailyMotion-BmnymjR1.esm.js → DailyMotion-gaY-1HqX.esm.js} +1 -1
- package/dist/{components/Facebook-D9Ak6ZJU.esm.js → Facebook-C_tH1Bi_.esm.js} +1 -1
- package/dist/{components/Facebook-42iqQU2G.js → Facebook-D4wLMJkY.js} +1 -1
- package/dist/{components/FilePlayer-CAnHK0Cd.js → FilePlayer-B4s5OcYq.js} +1 -1
- package/dist/{components/FilePlayer-wg9lyafD.esm.js → FilePlayer-DqR2mvGK.esm.js} +1 -1
- package/dist/{components/Kaltura-DPaEN-dq.esm.js → Kaltura-C9QbmEfO.esm.js} +1 -1
- package/dist/{components/Kaltura-Ct6kwbgP.js → Kaltura-kCqUZWuf.js} +1 -1
- package/dist/{components/Mixcloud-sBbcL5rG.js → Mixcloud-2c71b3Nf.js} +1 -1
- package/dist/{components/Mixcloud-BobSN3YI.esm.js → Mixcloud-ib_DIXF1.esm.js} +1 -1
- package/dist/{components/Mux-Cosy8sFO.js → Mux-BsXgGo6C.js} +1 -1
- package/dist/{components/Mux-B9YP-rFr.esm.js → Mux-CJ6kEh1R.esm.js} +1 -1
- package/dist/{components/Preview-DiVfo6aa.js → Preview-gEkhA4mX.js} +1 -1
- package/dist/{components/Preview-XcTlhHT1.esm.js → Preview-kqr7fWet.esm.js} +1 -1
- package/dist/{components/SoundCloud-CIWqB-QW.js → SoundCloud-BWup2g--.js} +1 -1
- package/dist/{components/SoundCloud-BTHoyFWT.esm.js → SoundCloud-DJM0bsQG.esm.js} +1 -1
- package/dist/{components/Streamable-DsfQCy3p.esm.js → Streamable-CJltauTy.esm.js} +1 -1
- package/dist/{components/Streamable-9anYiQtU.js → Streamable-UeTHV2nZ.js} +1 -1
- package/dist/{components/Twitch-D1BOr8hj.esm.js → Twitch-C9qq_89Q.esm.js} +1 -1
- package/dist/{components/Twitch-Dud6e1Rv.js → Twitch-_N8mEsiS.js} +1 -1
- package/dist/{components/Vidyard-BuOu85uS.js → Vidyard-CQuxB99Z.js} +1 -1
- package/dist/{components/Vidyard-C1csjpQH.esm.js → Vidyard-gtcLQdYd.esm.js} +1 -1
- package/dist/{components/Vimeo-CHlHIswX.esm.js → Vimeo-Dzp5eoLi.esm.js} +1 -1
- package/dist/{components/Vimeo-DrDJ5O9H.js → Vimeo-nhXVoFTb.js} +1 -1
- package/dist/{components/Wistia-fh9U2CA2.js → Wistia-C1DqA9IW.js} +1 -1
- package/dist/{components/Wistia-D-eYyONb.esm.js → Wistia-DV3BO3z9.esm.js} +1 -1
- package/dist/{components/YouTube-CmnnzZvk.esm.js → YouTube-BKwvJCnt.esm.js} +1 -1
- package/dist/{components/YouTube-DC2uZ14c.js → YouTube-DDou5phH.js} +1 -1
- package/dist/components/CourseCard/CourseCard.styles.d.ts +1 -1
- package/dist/components/DailyMotion-B8IJNjSc.js +180 -0
- package/dist/components/DailyMotion-COg3zgIZ.esm.js +178 -0
- package/dist/components/Facebook-DJ7a3Bj8.js +181 -0
- package/dist/components/Facebook-NS80Vk6j.esm.js +179 -0
- package/dist/components/FilePlayer-D-fc3B0E.esm.js +408 -0
- package/dist/components/FilePlayer-SyLt5qGX.js +410 -0
- package/dist/components/Kaltura-BTFxSMxP.js +178 -0
- package/dist/components/Kaltura-CmFIWSef.esm.js +176 -0
- package/dist/components/Mixcloud-CO5MsWUJ.esm.js +164 -0
- package/dist/components/Mixcloud-DHAfVpcc.js +166 -0
- package/dist/components/Mux-C8-HithD.esm.js +264 -0
- package/dist/components/Mux-bycDxP8G.js +266 -0
- package/dist/components/Preview-Clg3y6sj.esm.js +173 -0
- package/dist/components/Preview-CzpcknZI.js +175 -0
- package/dist/components/SoundCloud-Dz9DeIIM.js +183 -0
- package/dist/components/SoundCloud-LfWEBVy1.esm.js +181 -0
- package/dist/components/Streamable-BpcVhi4M.esm.js +174 -0
- package/dist/components/Streamable-Cs_c-7jS.js +176 -0
- package/dist/components/Twitch-BJ9aSIM2.esm.js +168 -0
- package/dist/components/Twitch-C9bksXF6.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/VideoPlayer/usePlayerControls.js +46 -64
- package/dist/components/VideoPlayer/usePlayerControls.js.map +1 -1
- package/dist/components/Vidyard-CsUFSBXh.js +174 -0
- package/dist/components/Vidyard-Dc8NHJ7p.esm.js +172 -0
- package/dist/components/Vimeo-CwlScNtK.esm.js +213 -0
- package/dist/components/Vimeo-D6C93592.js +215 -0
- package/dist/components/Wistia-Bxvdn3oO.js +190 -0
- package/dist/components/Wistia-Cwl4fNWW.esm.js +188 -0
- package/dist/components/YouTube-BF85SRPF.js +260 -0
- package/dist/components/YouTube-DKkYzN7-.esm.js +258 -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-DetZ05pw.js → index-C08W0lXg.js} +157 -295
- package/dist/components/{index-DKAGRUEW.esm.js → index-F6zEoSWf.esm.js} +156 -296
- 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-CcTTuhg8.esm.js +94920 -0
- package/dist/index-Dq4qpx9F.js +95142 -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
- package/dist/components/VideoPlayer/pipManager.d.ts +0 -60
- package/dist/components/VideoPlayer/pipManager.js +0 -272
- package/dist/components/VideoPlayer/pipManager.js.map +0 -1
- package/dist/components/components/VideoPlayer/pipManager.d.ts +0 -60
- package/dist/icons/components/VideoPlayer/pipManager.d.ts +0 -60
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { r as requireUtils, a as requirePatterns, g as getDefaultExportFromCjs } from './index-F6zEoSWf.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 FilePlayer_1;
|
|
20
|
+
var hasRequiredFilePlayer;
|
|
21
|
+
|
|
22
|
+
function requireFilePlayer () {
|
|
23
|
+
if (hasRequiredFilePlayer) return FilePlayer_1;
|
|
24
|
+
hasRequiredFilePlayer = 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 FilePlayer_exports = {};
|
|
58
|
+
__export(FilePlayer_exports, {
|
|
59
|
+
default: () => FilePlayer
|
|
60
|
+
});
|
|
61
|
+
FilePlayer_1 = __toCommonJS(FilePlayer_exports);
|
|
62
|
+
var import_react = __toESM(React__default);
|
|
63
|
+
var import_utils = /*@__PURE__*/ requireUtils();
|
|
64
|
+
var import_patterns = /*@__PURE__*/ requirePatterns();
|
|
65
|
+
const HAS_NAVIGATOR = typeof navigator !== "undefined";
|
|
66
|
+
const IS_IPAD_PRO = HAS_NAVIGATOR && navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
67
|
+
const IS_IOS = HAS_NAVIGATOR && (/iPad|iPhone|iPod/.test(navigator.userAgent) || IS_IPAD_PRO) && !window.MSStream;
|
|
68
|
+
const IS_SAFARI = HAS_NAVIGATOR && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !window.MSStream;
|
|
69
|
+
const HLS_SDK_URL = "https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js";
|
|
70
|
+
const HLS_GLOBAL = "Hls";
|
|
71
|
+
const DASH_SDK_URL = "https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js";
|
|
72
|
+
const DASH_GLOBAL = "dashjs";
|
|
73
|
+
const FLV_SDK_URL = "https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js";
|
|
74
|
+
const FLV_GLOBAL = "flvjs";
|
|
75
|
+
const MATCH_DROPBOX_URL = /www\.dropbox\.com\/.+/;
|
|
76
|
+
const MATCH_CLOUDFLARE_STREAM = /https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/;
|
|
77
|
+
const REPLACE_CLOUDFLARE_STREAM = "https://videodelivery.net/{id}/manifest/video.m3u8";
|
|
78
|
+
class FilePlayer extends import_react.Component {
|
|
79
|
+
constructor() {
|
|
80
|
+
super(...arguments);
|
|
81
|
+
// Proxy methods to prevent listener leaks
|
|
82
|
+
__publicField(this, "onReady", (...args) => this.props.onReady(...args));
|
|
83
|
+
__publicField(this, "onPlay", (...args) => this.props.onPlay(...args));
|
|
84
|
+
__publicField(this, "onBuffer", (...args) => this.props.onBuffer(...args));
|
|
85
|
+
__publicField(this, "onBufferEnd", (...args) => this.props.onBufferEnd(...args));
|
|
86
|
+
__publicField(this, "onPause", (...args) => this.props.onPause(...args));
|
|
87
|
+
__publicField(this, "onEnded", (...args) => this.props.onEnded(...args));
|
|
88
|
+
__publicField(this, "onError", (...args) => this.props.onError(...args));
|
|
89
|
+
__publicField(this, "onPlayBackRateChange", (event) => this.props.onPlaybackRateChange(event.target.playbackRate));
|
|
90
|
+
__publicField(this, "onEnablePIP", (...args) => this.props.onEnablePIP(...args));
|
|
91
|
+
__publicField(this, "onDisablePIP", (e) => {
|
|
92
|
+
const { onDisablePIP, playing } = this.props;
|
|
93
|
+
onDisablePIP(e);
|
|
94
|
+
if (playing) {
|
|
95
|
+
this.play();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
__publicField(this, "onPresentationModeChange", (e) => {
|
|
99
|
+
if (this.player && (0, import_utils.supportsWebKitPresentationMode)(this.player)) {
|
|
100
|
+
const { webkitPresentationMode } = this.player;
|
|
101
|
+
if (webkitPresentationMode === "picture-in-picture") {
|
|
102
|
+
this.onEnablePIP(e);
|
|
103
|
+
} else if (webkitPresentationMode === "inline") {
|
|
104
|
+
this.onDisablePIP(e);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
__publicField(this, "onSeek", (e) => {
|
|
109
|
+
this.props.onSeek(e.target.currentTime);
|
|
110
|
+
});
|
|
111
|
+
__publicField(this, "mute", () => {
|
|
112
|
+
this.player.muted = true;
|
|
113
|
+
});
|
|
114
|
+
__publicField(this, "unmute", () => {
|
|
115
|
+
this.player.muted = false;
|
|
116
|
+
});
|
|
117
|
+
__publicField(this, "renderSourceElement", (source, index) => {
|
|
118
|
+
if (typeof source === "string") {
|
|
119
|
+
return /* @__PURE__ */ import_react.default.createElement("source", { key: index, src: source });
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ import_react.default.createElement("source", { key: index, ...source });
|
|
122
|
+
});
|
|
123
|
+
__publicField(this, "renderTrack", (track, index) => {
|
|
124
|
+
return /* @__PURE__ */ import_react.default.createElement("track", { key: index, ...track });
|
|
125
|
+
});
|
|
126
|
+
__publicField(this, "ref", (player) => {
|
|
127
|
+
if (this.player) {
|
|
128
|
+
this.prevPlayer = this.player;
|
|
129
|
+
}
|
|
130
|
+
this.player = player;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
componentDidMount() {
|
|
134
|
+
this.props.onMount && this.props.onMount(this);
|
|
135
|
+
this.addListeners(this.player);
|
|
136
|
+
const src = this.getSource(this.props.url);
|
|
137
|
+
if (src) {
|
|
138
|
+
this.player.src = src;
|
|
139
|
+
}
|
|
140
|
+
if (IS_IOS || this.props.config.forceDisableHls) {
|
|
141
|
+
this.player.load();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
componentDidUpdate(prevProps) {
|
|
145
|
+
if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(prevProps)) {
|
|
146
|
+
this.removeListeners(this.prevPlayer, prevProps.url);
|
|
147
|
+
this.addListeners(this.player);
|
|
148
|
+
}
|
|
149
|
+
if (this.props.url !== prevProps.url && !(0, import_utils.isMediaStream)(this.props.url) && !(this.props.url instanceof Array)) {
|
|
150
|
+
this.player.srcObject = null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
componentWillUnmount() {
|
|
154
|
+
this.player.removeAttribute("src");
|
|
155
|
+
this.removeListeners(this.player);
|
|
156
|
+
if (this.hls) {
|
|
157
|
+
this.hls.destroy();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
addListeners(player) {
|
|
161
|
+
const { url, playsinline } = this.props;
|
|
162
|
+
player.addEventListener("play", this.onPlay);
|
|
163
|
+
player.addEventListener("waiting", this.onBuffer);
|
|
164
|
+
player.addEventListener("playing", this.onBufferEnd);
|
|
165
|
+
player.addEventListener("pause", this.onPause);
|
|
166
|
+
player.addEventListener("seeked", this.onSeek);
|
|
167
|
+
player.addEventListener("ended", this.onEnded);
|
|
168
|
+
player.addEventListener("error", this.onError);
|
|
169
|
+
player.addEventListener("ratechange", this.onPlayBackRateChange);
|
|
170
|
+
player.addEventListener("enterpictureinpicture", this.onEnablePIP);
|
|
171
|
+
player.addEventListener("leavepictureinpicture", this.onDisablePIP);
|
|
172
|
+
player.addEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
|
|
173
|
+
if (!this.shouldUseHLS(url)) {
|
|
174
|
+
player.addEventListener("canplay", this.onReady);
|
|
175
|
+
}
|
|
176
|
+
if (playsinline) {
|
|
177
|
+
player.setAttribute("playsinline", "");
|
|
178
|
+
player.setAttribute("webkit-playsinline", "");
|
|
179
|
+
player.setAttribute("x5-playsinline", "");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
removeListeners(player, url) {
|
|
183
|
+
player.removeEventListener("canplay", this.onReady);
|
|
184
|
+
player.removeEventListener("play", this.onPlay);
|
|
185
|
+
player.removeEventListener("waiting", this.onBuffer);
|
|
186
|
+
player.removeEventListener("playing", this.onBufferEnd);
|
|
187
|
+
player.removeEventListener("pause", this.onPause);
|
|
188
|
+
player.removeEventListener("seeked", this.onSeek);
|
|
189
|
+
player.removeEventListener("ended", this.onEnded);
|
|
190
|
+
player.removeEventListener("error", this.onError);
|
|
191
|
+
player.removeEventListener("ratechange", this.onPlayBackRateChange);
|
|
192
|
+
player.removeEventListener("enterpictureinpicture", this.onEnablePIP);
|
|
193
|
+
player.removeEventListener("leavepictureinpicture", this.onDisablePIP);
|
|
194
|
+
player.removeEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
|
|
195
|
+
if (!this.shouldUseHLS(url)) {
|
|
196
|
+
player.removeEventListener("canplay", this.onReady);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
shouldUseAudio(props) {
|
|
200
|
+
if (props.config.forceVideo) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
if (props.config.attributes.poster) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return import_patterns.AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio;
|
|
207
|
+
}
|
|
208
|
+
shouldUseHLS(url) {
|
|
209
|
+
if (IS_SAFARI && this.props.config.forceSafariHLS || this.props.config.forceHLS) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
if (IS_IOS || this.props.config.forceDisableHls) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
return import_patterns.HLS_EXTENSIONS.test(url) || MATCH_CLOUDFLARE_STREAM.test(url);
|
|
216
|
+
}
|
|
217
|
+
shouldUseDASH(url) {
|
|
218
|
+
return import_patterns.DASH_EXTENSIONS.test(url) || this.props.config.forceDASH;
|
|
219
|
+
}
|
|
220
|
+
shouldUseFLV(url) {
|
|
221
|
+
return import_patterns.FLV_EXTENSIONS.test(url) || this.props.config.forceFLV;
|
|
222
|
+
}
|
|
223
|
+
load(url) {
|
|
224
|
+
const { hlsVersion, hlsOptions, dashVersion, flvVersion } = this.props.config;
|
|
225
|
+
if (this.hls) {
|
|
226
|
+
this.hls.destroy();
|
|
227
|
+
}
|
|
228
|
+
if (this.dash) {
|
|
229
|
+
this.dash.reset();
|
|
230
|
+
}
|
|
231
|
+
if (this.shouldUseHLS(url)) {
|
|
232
|
+
(0, import_utils.getSDK)(HLS_SDK_URL.replace("VERSION", hlsVersion), HLS_GLOBAL).then((Hls) => {
|
|
233
|
+
this.hls = new Hls(hlsOptions);
|
|
234
|
+
this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
|
235
|
+
this.props.onReady();
|
|
236
|
+
});
|
|
237
|
+
this.hls.on(Hls.Events.ERROR, (e, data) => {
|
|
238
|
+
this.props.onError(e, data, this.hls, Hls);
|
|
239
|
+
});
|
|
240
|
+
if (MATCH_CLOUDFLARE_STREAM.test(url)) {
|
|
241
|
+
const id = url.match(MATCH_CLOUDFLARE_STREAM)[1];
|
|
242
|
+
this.hls.loadSource(REPLACE_CLOUDFLARE_STREAM.replace("{id}", id));
|
|
243
|
+
} else {
|
|
244
|
+
this.hls.loadSource(url);
|
|
245
|
+
}
|
|
246
|
+
this.hls.attachMedia(this.player);
|
|
247
|
+
this.props.onLoaded();
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
if (this.shouldUseDASH(url)) {
|
|
251
|
+
(0, import_utils.getSDK)(DASH_SDK_URL.replace("VERSION", dashVersion), DASH_GLOBAL).then((dashjs) => {
|
|
252
|
+
this.dash = dashjs.MediaPlayer().create();
|
|
253
|
+
this.dash.initialize(this.player, url, this.props.playing);
|
|
254
|
+
this.dash.on("error", this.props.onError);
|
|
255
|
+
if (parseInt(dashVersion) < 3) {
|
|
256
|
+
this.dash.getDebug().setLogToBrowserConsole(false);
|
|
257
|
+
} else {
|
|
258
|
+
this.dash.updateSettings({ debug: { logLevel: dashjs.Debug.LOG_LEVEL_NONE } });
|
|
259
|
+
}
|
|
260
|
+
this.props.onLoaded();
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
if (this.shouldUseFLV(url)) {
|
|
264
|
+
(0, import_utils.getSDK)(FLV_SDK_URL.replace("VERSION", flvVersion), FLV_GLOBAL).then((flvjs) => {
|
|
265
|
+
this.flv = flvjs.createPlayer({ type: "flv", url });
|
|
266
|
+
this.flv.attachMediaElement(this.player);
|
|
267
|
+
this.flv.on(flvjs.Events.ERROR, (e, data) => {
|
|
268
|
+
this.props.onError(e, data, this.flv, flvjs);
|
|
269
|
+
});
|
|
270
|
+
this.flv.load();
|
|
271
|
+
this.props.onLoaded();
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
if (url instanceof Array) {
|
|
275
|
+
this.player.load();
|
|
276
|
+
} else if ((0, import_utils.isMediaStream)(url)) {
|
|
277
|
+
try {
|
|
278
|
+
this.player.srcObject = url;
|
|
279
|
+
} catch (e) {
|
|
280
|
+
this.player.src = window.URL.createObjectURL(url);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
play() {
|
|
285
|
+
const promise = this.player.play();
|
|
286
|
+
if (promise) {
|
|
287
|
+
promise.catch(this.props.onError);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
pause() {
|
|
291
|
+
this.player.pause();
|
|
292
|
+
}
|
|
293
|
+
stop() {
|
|
294
|
+
this.player.removeAttribute("src");
|
|
295
|
+
if (this.dash) {
|
|
296
|
+
this.dash.reset();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
seekTo(seconds, keepPlaying = true) {
|
|
300
|
+
this.player.currentTime = seconds;
|
|
301
|
+
if (!keepPlaying) {
|
|
302
|
+
this.pause();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
setVolume(fraction) {
|
|
306
|
+
this.player.volume = fraction;
|
|
307
|
+
}
|
|
308
|
+
enablePIP() {
|
|
309
|
+
if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) {
|
|
310
|
+
this.player.requestPictureInPicture();
|
|
311
|
+
} else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "picture-in-picture") {
|
|
312
|
+
this.player.webkitSetPresentationMode("picture-in-picture");
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
disablePIP() {
|
|
316
|
+
if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) {
|
|
317
|
+
document.exitPictureInPicture();
|
|
318
|
+
} else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "inline") {
|
|
319
|
+
this.player.webkitSetPresentationMode("inline");
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
setPlaybackRate(rate) {
|
|
323
|
+
try {
|
|
324
|
+
this.player.playbackRate = rate;
|
|
325
|
+
} catch (error) {
|
|
326
|
+
this.props.onError(error);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
getDuration() {
|
|
330
|
+
if (!this.player)
|
|
331
|
+
return null;
|
|
332
|
+
const { duration, seekable } = this.player;
|
|
333
|
+
if (duration === Infinity && seekable.length > 0) {
|
|
334
|
+
return seekable.end(seekable.length - 1);
|
|
335
|
+
}
|
|
336
|
+
return duration;
|
|
337
|
+
}
|
|
338
|
+
getCurrentTime() {
|
|
339
|
+
if (!this.player)
|
|
340
|
+
return null;
|
|
341
|
+
return this.player.currentTime;
|
|
342
|
+
}
|
|
343
|
+
getSecondsLoaded() {
|
|
344
|
+
if (!this.player)
|
|
345
|
+
return null;
|
|
346
|
+
const { buffered } = this.player;
|
|
347
|
+
if (buffered.length === 0) {
|
|
348
|
+
return 0;
|
|
349
|
+
}
|
|
350
|
+
const end = buffered.end(buffered.length - 1);
|
|
351
|
+
const duration = this.getDuration();
|
|
352
|
+
if (end > duration) {
|
|
353
|
+
return duration;
|
|
354
|
+
}
|
|
355
|
+
return end;
|
|
356
|
+
}
|
|
357
|
+
getSource(url) {
|
|
358
|
+
const useHLS = this.shouldUseHLS(url);
|
|
359
|
+
const useDASH = this.shouldUseDASH(url);
|
|
360
|
+
const useFLV = this.shouldUseFLV(url);
|
|
361
|
+
if (url instanceof Array || (0, import_utils.isMediaStream)(url) || useHLS || useDASH || useFLV) {
|
|
362
|
+
return void 0;
|
|
363
|
+
}
|
|
364
|
+
if (MATCH_DROPBOX_URL.test(url)) {
|
|
365
|
+
return url.replace("www.dropbox.com", "dl.dropboxusercontent.com");
|
|
366
|
+
}
|
|
367
|
+
return url;
|
|
368
|
+
}
|
|
369
|
+
render() {
|
|
370
|
+
const { url, playing, loop, controls, muted, config, width, height } = this.props;
|
|
371
|
+
const useAudio = this.shouldUseAudio(this.props);
|
|
372
|
+
const Element = useAudio ? "audio" : "video";
|
|
373
|
+
const style = {
|
|
374
|
+
width: width === "auto" ? width : "100%",
|
|
375
|
+
height: height === "auto" ? height : "100%"
|
|
376
|
+
};
|
|
377
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
378
|
+
Element,
|
|
379
|
+
{
|
|
380
|
+
ref: this.ref,
|
|
381
|
+
src: this.getSource(url),
|
|
382
|
+
style,
|
|
383
|
+
preload: "auto",
|
|
384
|
+
autoPlay: playing || void 0,
|
|
385
|
+
controls,
|
|
386
|
+
muted,
|
|
387
|
+
loop,
|
|
388
|
+
...config.attributes
|
|
389
|
+
},
|
|
390
|
+
url instanceof Array && url.map(this.renderSourceElement),
|
|
391
|
+
config.tracks.map(this.renderTrack)
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
__publicField(FilePlayer, "displayName", "FilePlayer");
|
|
396
|
+
__publicField(FilePlayer, "canPlay", import_patterns.canPlay.file);
|
|
397
|
+
return FilePlayer_1;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
var FilePlayerExports = /*@__PURE__*/ requireFilePlayer();
|
|
401
|
+
var FilePlayer = /*@__PURE__*/getDefaultExportFromCjs(FilePlayerExports);
|
|
402
|
+
|
|
403
|
+
var FilePlayer$1 = /*#__PURE__*/_mergeNamespaces({
|
|
404
|
+
__proto__: null,
|
|
405
|
+
default: FilePlayer
|
|
406
|
+
}, [FilePlayerExports]);
|
|
407
|
+
|
|
408
|
+
export { FilePlayer$1 as F };
|