suada-components 1.0.2504230710 → 1.1.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.
Files changed (200) hide show
  1. package/dist/components/BreadCrumb/Breadcrumb.js.map +1 -1
  2. package/dist/components/Button/Button.interface.d.ts +1 -0
  3. package/dist/components/DailyMotion-B2EpqlJO.esm.js +178 -0
  4. package/dist/components/DailyMotion-BYA5rhY5.js +180 -0
  5. package/dist/components/Facebook-DBxSErS8.esm.js +179 -0
  6. package/dist/components/Facebook-DJMdBwGM.js +181 -0
  7. package/dist/components/FilePlayer-DLiC_Doh.esm.js +408 -0
  8. package/dist/components/FilePlayer-DRqq2T-L.js +410 -0
  9. package/dist/components/Kaltura-BAvKhQp8.esm.js +176 -0
  10. package/dist/components/Kaltura-DFK3UxTc.js +178 -0
  11. package/dist/components/Mixcloud-C0S4Txcb.esm.js +164 -0
  12. package/dist/components/Mixcloud-CnG6kbdi.js +166 -0
  13. package/dist/components/Mux-BCS9rYAf.esm.js +264 -0
  14. package/dist/components/Mux-ChXwYRDL.js +266 -0
  15. package/dist/components/Preview-CPdzmWpt.js +175 -0
  16. package/dist/components/Preview-MgDcO7wW.esm.js +173 -0
  17. package/dist/components/SoundCloud-BxxMgfs2.esm.js +181 -0
  18. package/dist/components/SoundCloud-CcFGRoSv.js +183 -0
  19. package/dist/components/Streamable-BIBOfZ0w.js +176 -0
  20. package/dist/components/Streamable-Drn6K8AN.esm.js +174 -0
  21. package/dist/components/Twitch-CGC2HQMj.esm.js +168 -0
  22. package/dist/components/Twitch-DoUQRPQR.js +170 -0
  23. package/dist/components/VideoPlayer/Controls/Controls.d.ts +4 -0
  24. package/dist/components/VideoPlayer/Controls/Controls.interface.d.ts +32 -0
  25. package/dist/components/VideoPlayer/Controls/Controls.interface.js +2 -0
  26. package/dist/components/VideoPlayer/Controls/Controls.interface.js.map +1 -0
  27. package/dist/components/VideoPlayer/Controls/Controls.js +36 -0
  28. package/dist/components/VideoPlayer/Controls/Controls.js.map +1 -0
  29. package/dist/components/VideoPlayer/Controls/Controls.styles.d.ts +16 -0
  30. package/dist/components/VideoPlayer/Controls/Controls.styles.js +25 -0
  31. package/dist/components/VideoPlayer/Controls/Controls.styles.js.map +1 -0
  32. package/dist/components/VideoPlayer/Controls/index.d.ts +1 -0
  33. package/dist/components/VideoPlayer/Controls/index.js +2 -0
  34. package/dist/components/VideoPlayer/Controls/index.js.map +1 -0
  35. package/dist/components/VideoPlayer/PlaybackSpeedMenu.d.ts +4 -0
  36. package/dist/components/VideoPlayer/PlaybackSpeedMenu.interface.d.ts +18 -0
  37. package/dist/components/VideoPlayer/PlaybackSpeedMenu.interface.js +2 -0
  38. package/dist/components/VideoPlayer/PlaybackSpeedMenu.interface.js.map +1 -0
  39. package/dist/components/VideoPlayer/PlaybackSpeedMenu.js +20 -0
  40. package/dist/components/VideoPlayer/PlaybackSpeedMenu.js.map +1 -0
  41. package/dist/components/VideoPlayer/PlaybackSpeedMenu.styles.d.ts +4 -0
  42. package/dist/components/VideoPlayer/PlaybackSpeedMenu.styles.js +18 -0
  43. package/dist/components/VideoPlayer/PlaybackSpeedMenu.styles.js.map +1 -0
  44. package/dist/components/VideoPlayer/Player.d.ts +3 -11
  45. package/dist/components/VideoPlayer/Player.interface.d.ts +63 -0
  46. package/dist/components/VideoPlayer/Player.interface.js +2 -0
  47. package/dist/components/VideoPlayer/Player.interface.js.map +1 -0
  48. package/dist/components/VideoPlayer/Player.js +82 -97
  49. package/dist/components/VideoPlayer/Player.js.map +1 -1
  50. package/dist/components/VideoPlayer/Player.styles.d.ts +8 -0
  51. package/dist/components/VideoPlayer/Player.styles.js +17 -0
  52. package/dist/components/VideoPlayer/Player.styles.js.map +1 -0
  53. package/dist/components/VideoPlayer/VideoPlayer.stories.d.ts +10 -26
  54. package/dist/components/VideoPlayer/VideoPlayer.stories.js +174 -19
  55. package/dist/components/VideoPlayer/VideoPlayer.stories.js.map +1 -1
  56. package/dist/components/VideoPlayer/constants/index.d.ts +2 -0
  57. package/dist/components/VideoPlayer/constants/index.js +31 -0
  58. package/dist/components/VideoPlayer/constants/index.js.map +1 -0
  59. package/dist/components/VideoPlayer/parseVtt.d.ts +6 -0
  60. package/dist/components/VideoPlayer/parseVtt.js +35 -0
  61. package/dist/components/VideoPlayer/parseVtt.js.map +1 -0
  62. package/dist/components/VideoPlayer/timeConversion.d.ts +5 -0
  63. package/dist/components/VideoPlayer/timeConversion.js +70 -0
  64. package/dist/components/VideoPlayer/timeConversion.js.map +1 -0
  65. package/dist/components/VideoPlayer/useDynamicPosition.d.ts +16 -0
  66. package/dist/components/VideoPlayer/useDynamicPosition.js +50 -0
  67. package/dist/components/VideoPlayer/useDynamicPosition.js.map +1 -0
  68. package/dist/components/VideoPlayer/useEventListener.d.ts +3 -0
  69. package/dist/components/VideoPlayer/useEventListener.js +27 -0
  70. package/dist/components/VideoPlayer/useEventListener.js.map +1 -0
  71. package/dist/components/VideoPlayer/useMenuToggle.d.ts +22 -0
  72. package/dist/components/VideoPlayer/useMenuToggle.js +25 -0
  73. package/dist/components/VideoPlayer/useMenuToggle.js.map +1 -0
  74. package/dist/components/VideoPlayer/useOnOutsideClick.d.ts +3 -0
  75. package/dist/components/VideoPlayer/useOnOutsideClick.js +16 -0
  76. package/dist/components/VideoPlayer/useOnOutsideClick.js.map +1 -0
  77. package/dist/components/VideoPlayer/usePlayerControls.d.ts +3 -0
  78. package/dist/components/VideoPlayer/usePlayerControls.js +330 -0
  79. package/dist/components/VideoPlayer/usePlayerControls.js.map +1 -0
  80. package/dist/components/Vidyard-B-jW75yA.esm.js +172 -0
  81. package/dist/components/Vidyard-If2H-ayj.js +174 -0
  82. package/dist/components/Vimeo-Cvg3rB5o.esm.js +213 -0
  83. package/dist/components/Vimeo-hI3cddOi.js +215 -0
  84. package/dist/components/Wistia-BtYIM6Uo.esm.js +188 -0
  85. package/dist/components/Wistia-CZwfIsgx.js +190 -0
  86. package/dist/components/YouTube-D1u9T9FZ.js +260 -0
  87. package/dist/components/YouTube-vwMwhQ13.esm.js +258 -0
  88. package/dist/components/components/Button/Button.interface.d.ts +1 -0
  89. package/dist/components/components/VideoPlayer/Controls/Controls.d.ts +4 -0
  90. package/dist/components/components/VideoPlayer/Controls/Controls.interface.d.ts +32 -0
  91. package/dist/components/components/VideoPlayer/Controls/Controls.styles.d.ts +16 -0
  92. package/dist/components/components/VideoPlayer/Controls/index.d.ts +1 -0
  93. package/dist/components/components/VideoPlayer/PlaybackSpeedMenu.d.ts +4 -0
  94. package/dist/components/components/VideoPlayer/PlaybackSpeedMenu.interface.d.ts +18 -0
  95. package/dist/components/components/VideoPlayer/PlaybackSpeedMenu.styles.d.ts +4 -0
  96. package/dist/components/components/VideoPlayer/Player.d.ts +3 -11
  97. package/dist/components/components/VideoPlayer/Player.interface.d.ts +63 -0
  98. package/dist/components/components/VideoPlayer/Player.styles.d.ts +8 -0
  99. package/dist/components/components/VideoPlayer/constants/index.d.ts +2 -0
  100. package/dist/components/components/VideoPlayer/parseVtt.d.ts +6 -0
  101. package/dist/components/components/VideoPlayer/timeConversion.d.ts +5 -0
  102. package/dist/components/components/VideoPlayer/useDynamicPosition.d.ts +16 -0
  103. package/dist/components/components/VideoPlayer/useEventListener.d.ts +3 -0
  104. package/dist/components/components/VideoPlayer/useMenuToggle.d.ts +22 -0
  105. package/dist/components/components/VideoPlayer/useOnOutsideClick.d.ts +3 -0
  106. package/dist/components/components/VideoPlayer/usePlayerControls.d.ts +3 -0
  107. package/dist/components/icons/Heart.d.ts +7 -0
  108. package/dist/components/icons/Maximize.d.ts +3 -0
  109. package/dist/components/icons/Meter.d.ts +3 -0
  110. package/dist/components/icons/Minimize.d.ts +3 -0
  111. package/dist/components/icons/Pause.d.ts +3 -0
  112. package/dist/components/icons/Play.d.ts +3 -0
  113. package/dist/components/icons/Rewind.d.ts +7 -0
  114. package/dist/components/icons/Skip.d.ts +8 -0
  115. package/dist/components/icons/Subtitles.d.ts +7 -0
  116. package/dist/components/icons/VideoCheckmark.d.ts +3 -0
  117. package/dist/components/icons/VolumeMute.d.ts +8 -0
  118. package/dist/components/icons/VolumeUp.d.ts +8 -0
  119. package/dist/components/icons/index.d.ts +11 -0
  120. package/dist/components/index-DLzCbCHu.esm.js +94482 -0
  121. package/dist/components/index-wLnkslO9.js +94536 -0
  122. package/dist/components/index.esm.js +3 -122501
  123. package/dist/icons/Heart.d.ts +7 -0
  124. package/dist/icons/Heart.js +28 -0
  125. package/dist/icons/Heart.js.map +1 -0
  126. package/dist/icons/Maximize.d.ts +3 -0
  127. package/dist/icons/Maximize.js +28 -0
  128. package/dist/icons/Maximize.js.map +1 -0
  129. package/dist/icons/Meter.d.ts +3 -0
  130. package/dist/icons/Meter.js +28 -0
  131. package/dist/icons/Meter.js.map +1 -0
  132. package/dist/icons/Minimize.d.ts +3 -0
  133. package/dist/icons/Minimize.js +28 -0
  134. package/dist/icons/Minimize.js.map +1 -0
  135. package/dist/icons/Pause.d.ts +3 -0
  136. package/dist/icons/Pause.js +28 -0
  137. package/dist/icons/Pause.js.map +1 -0
  138. package/dist/icons/Play.d.ts +3 -0
  139. package/dist/icons/Play.js +28 -0
  140. package/dist/icons/Play.js.map +1 -0
  141. package/dist/icons/Rewind.d.ts +7 -0
  142. package/dist/icons/Rewind.js +28 -0
  143. package/dist/icons/Rewind.js.map +1 -0
  144. package/dist/icons/Skip.d.ts +8 -0
  145. package/dist/icons/Skip.js +28 -0
  146. package/dist/icons/Skip.js.map +1 -0
  147. package/dist/icons/Subtitles.d.ts +7 -0
  148. package/dist/icons/Subtitles.js +28 -0
  149. package/dist/icons/Subtitles.js.map +1 -0
  150. package/dist/icons/VideoCheckmark.d.ts +3 -0
  151. package/dist/icons/VideoCheckmark.js +28 -0
  152. package/dist/icons/VideoCheckmark.js.map +1 -0
  153. package/dist/icons/VolumeMute.d.ts +8 -0
  154. package/dist/icons/VolumeMute.js +28 -0
  155. package/dist/icons/VolumeMute.js.map +1 -0
  156. package/dist/icons/VolumeUp.d.ts +8 -0
  157. package/dist/icons/VolumeUp.js +28 -0
  158. package/dist/icons/VolumeUp.js.map +1 -0
  159. package/dist/icons/components/Button/Button.interface.d.ts +1 -0
  160. package/dist/icons/components/VideoPlayer/Controls/Controls.d.ts +4 -0
  161. package/dist/icons/components/VideoPlayer/Controls/Controls.interface.d.ts +32 -0
  162. package/dist/icons/components/VideoPlayer/Controls/Controls.styles.d.ts +16 -0
  163. package/dist/icons/components/VideoPlayer/Controls/index.d.ts +1 -0
  164. package/dist/icons/components/VideoPlayer/PlaybackSpeedMenu.d.ts +4 -0
  165. package/dist/icons/components/VideoPlayer/PlaybackSpeedMenu.interface.d.ts +18 -0
  166. package/dist/icons/components/VideoPlayer/PlaybackSpeedMenu.styles.d.ts +4 -0
  167. package/dist/icons/components/VideoPlayer/Player.d.ts +3 -11
  168. package/dist/icons/components/VideoPlayer/Player.interface.d.ts +63 -0
  169. package/dist/icons/components/VideoPlayer/Player.styles.d.ts +8 -0
  170. package/dist/icons/components/VideoPlayer/constants/index.d.ts +2 -0
  171. package/dist/icons/components/VideoPlayer/parseVtt.d.ts +6 -0
  172. package/dist/icons/components/VideoPlayer/timeConversion.d.ts +5 -0
  173. package/dist/icons/components/VideoPlayer/useDynamicPosition.d.ts +16 -0
  174. package/dist/icons/components/VideoPlayer/useEventListener.d.ts +3 -0
  175. package/dist/icons/components/VideoPlayer/useMenuToggle.d.ts +22 -0
  176. package/dist/icons/components/VideoPlayer/useOnOutsideClick.d.ts +3 -0
  177. package/dist/icons/components/VideoPlayer/usePlayerControls.d.ts +3 -0
  178. package/dist/icons/icons/Heart.d.ts +7 -0
  179. package/dist/icons/icons/Maximize.d.ts +3 -0
  180. package/dist/icons/icons/Meter.d.ts +3 -0
  181. package/dist/icons/icons/Minimize.d.ts +3 -0
  182. package/dist/icons/icons/Pause.d.ts +3 -0
  183. package/dist/icons/icons/Play.d.ts +3 -0
  184. package/dist/icons/icons/Rewind.d.ts +7 -0
  185. package/dist/icons/icons/Skip.d.ts +8 -0
  186. package/dist/icons/icons/Subtitles.d.ts +7 -0
  187. package/dist/icons/icons/VideoCheckmark.d.ts +3 -0
  188. package/dist/icons/icons/VolumeMute.d.ts +8 -0
  189. package/dist/icons/icons/VolumeUp.d.ts +8 -0
  190. package/dist/icons/icons/index.d.ts +11 -0
  191. package/dist/icons/index.d.ts +11 -0
  192. package/dist/icons/index.esm.js +308 -1
  193. package/dist/icons/index.js +11 -0
  194. package/dist/icons/index.js.map +1 -1
  195. package/package.json +3 -1
  196. package/dist/components/VideoPlayer/styled-components.d.ts +0 -9
  197. package/dist/components/VideoPlayer/styled-components.js +0 -19
  198. package/dist/components/VideoPlayer/styled-components.js.map +0 -1
  199. package/dist/components/components/VideoPlayer/styled-components.d.ts +0 -9
  200. package/dist/icons/components/VideoPlayer/styled-components.d.ts +0 -9
@@ -0,0 +1,410 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-wLnkslO9.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 FilePlayer_1;
22
+ var hasRequiredFilePlayer;
23
+
24
+ function requireFilePlayer () {
25
+ if (hasRequiredFilePlayer) return FilePlayer_1;
26
+ hasRequiredFilePlayer = 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 FilePlayer_exports = {};
60
+ __export(FilePlayer_exports, {
61
+ default: () => FilePlayer
62
+ });
63
+ FilePlayer_1 = __toCommonJS(FilePlayer_exports);
64
+ var import_react = __toESM(React);
65
+ var import_utils = /*@__PURE__*/ index.requireUtils();
66
+ var import_patterns = /*@__PURE__*/ index.requirePatterns();
67
+ const HAS_NAVIGATOR = typeof navigator !== "undefined";
68
+ const IS_IPAD_PRO = HAS_NAVIGATOR && navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
69
+ const IS_IOS = HAS_NAVIGATOR && (/iPad|iPhone|iPod/.test(navigator.userAgent) || IS_IPAD_PRO) && !window.MSStream;
70
+ const IS_SAFARI = HAS_NAVIGATOR && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !window.MSStream;
71
+ const HLS_SDK_URL = "https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js";
72
+ const HLS_GLOBAL = "Hls";
73
+ const DASH_SDK_URL = "https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js";
74
+ const DASH_GLOBAL = "dashjs";
75
+ const FLV_SDK_URL = "https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js";
76
+ const FLV_GLOBAL = "flvjs";
77
+ const MATCH_DROPBOX_URL = /www\.dropbox\.com\/.+/;
78
+ const MATCH_CLOUDFLARE_STREAM = /https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/;
79
+ const REPLACE_CLOUDFLARE_STREAM = "https://videodelivery.net/{id}/manifest/video.m3u8";
80
+ class FilePlayer extends import_react.Component {
81
+ constructor() {
82
+ super(...arguments);
83
+ // Proxy methods to prevent listener leaks
84
+ __publicField(this, "onReady", (...args) => this.props.onReady(...args));
85
+ __publicField(this, "onPlay", (...args) => this.props.onPlay(...args));
86
+ __publicField(this, "onBuffer", (...args) => this.props.onBuffer(...args));
87
+ __publicField(this, "onBufferEnd", (...args) => this.props.onBufferEnd(...args));
88
+ __publicField(this, "onPause", (...args) => this.props.onPause(...args));
89
+ __publicField(this, "onEnded", (...args) => this.props.onEnded(...args));
90
+ __publicField(this, "onError", (...args) => this.props.onError(...args));
91
+ __publicField(this, "onPlayBackRateChange", (event) => this.props.onPlaybackRateChange(event.target.playbackRate));
92
+ __publicField(this, "onEnablePIP", (...args) => this.props.onEnablePIP(...args));
93
+ __publicField(this, "onDisablePIP", (e) => {
94
+ const { onDisablePIP, playing } = this.props;
95
+ onDisablePIP(e);
96
+ if (playing) {
97
+ this.play();
98
+ }
99
+ });
100
+ __publicField(this, "onPresentationModeChange", (e) => {
101
+ if (this.player && (0, import_utils.supportsWebKitPresentationMode)(this.player)) {
102
+ const { webkitPresentationMode } = this.player;
103
+ if (webkitPresentationMode === "picture-in-picture") {
104
+ this.onEnablePIP(e);
105
+ } else if (webkitPresentationMode === "inline") {
106
+ this.onDisablePIP(e);
107
+ }
108
+ }
109
+ });
110
+ __publicField(this, "onSeek", (e) => {
111
+ this.props.onSeek(e.target.currentTime);
112
+ });
113
+ __publicField(this, "mute", () => {
114
+ this.player.muted = true;
115
+ });
116
+ __publicField(this, "unmute", () => {
117
+ this.player.muted = false;
118
+ });
119
+ __publicField(this, "renderSourceElement", (source, index) => {
120
+ if (typeof source === "string") {
121
+ return /* @__PURE__ */ import_react.default.createElement("source", { key: index, src: source });
122
+ }
123
+ return /* @__PURE__ */ import_react.default.createElement("source", { key: index, ...source });
124
+ });
125
+ __publicField(this, "renderTrack", (track, index) => {
126
+ return /* @__PURE__ */ import_react.default.createElement("track", { key: index, ...track });
127
+ });
128
+ __publicField(this, "ref", (player) => {
129
+ if (this.player) {
130
+ this.prevPlayer = this.player;
131
+ }
132
+ this.player = player;
133
+ });
134
+ }
135
+ componentDidMount() {
136
+ this.props.onMount && this.props.onMount(this);
137
+ this.addListeners(this.player);
138
+ const src = this.getSource(this.props.url);
139
+ if (src) {
140
+ this.player.src = src;
141
+ }
142
+ if (IS_IOS || this.props.config.forceDisableHls) {
143
+ this.player.load();
144
+ }
145
+ }
146
+ componentDidUpdate(prevProps) {
147
+ if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(prevProps)) {
148
+ this.removeListeners(this.prevPlayer, prevProps.url);
149
+ this.addListeners(this.player);
150
+ }
151
+ if (this.props.url !== prevProps.url && !(0, import_utils.isMediaStream)(this.props.url) && !(this.props.url instanceof Array)) {
152
+ this.player.srcObject = null;
153
+ }
154
+ }
155
+ componentWillUnmount() {
156
+ this.player.removeAttribute("src");
157
+ this.removeListeners(this.player);
158
+ if (this.hls) {
159
+ this.hls.destroy();
160
+ }
161
+ }
162
+ addListeners(player) {
163
+ const { url, playsinline } = this.props;
164
+ player.addEventListener("play", this.onPlay);
165
+ player.addEventListener("waiting", this.onBuffer);
166
+ player.addEventListener("playing", this.onBufferEnd);
167
+ player.addEventListener("pause", this.onPause);
168
+ player.addEventListener("seeked", this.onSeek);
169
+ player.addEventListener("ended", this.onEnded);
170
+ player.addEventListener("error", this.onError);
171
+ player.addEventListener("ratechange", this.onPlayBackRateChange);
172
+ player.addEventListener("enterpictureinpicture", this.onEnablePIP);
173
+ player.addEventListener("leavepictureinpicture", this.onDisablePIP);
174
+ player.addEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
175
+ if (!this.shouldUseHLS(url)) {
176
+ player.addEventListener("canplay", this.onReady);
177
+ }
178
+ if (playsinline) {
179
+ player.setAttribute("playsinline", "");
180
+ player.setAttribute("webkit-playsinline", "");
181
+ player.setAttribute("x5-playsinline", "");
182
+ }
183
+ }
184
+ removeListeners(player, url) {
185
+ player.removeEventListener("canplay", this.onReady);
186
+ player.removeEventListener("play", this.onPlay);
187
+ player.removeEventListener("waiting", this.onBuffer);
188
+ player.removeEventListener("playing", this.onBufferEnd);
189
+ player.removeEventListener("pause", this.onPause);
190
+ player.removeEventListener("seeked", this.onSeek);
191
+ player.removeEventListener("ended", this.onEnded);
192
+ player.removeEventListener("error", this.onError);
193
+ player.removeEventListener("ratechange", this.onPlayBackRateChange);
194
+ player.removeEventListener("enterpictureinpicture", this.onEnablePIP);
195
+ player.removeEventListener("leavepictureinpicture", this.onDisablePIP);
196
+ player.removeEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
197
+ if (!this.shouldUseHLS(url)) {
198
+ player.removeEventListener("canplay", this.onReady);
199
+ }
200
+ }
201
+ shouldUseAudio(props) {
202
+ if (props.config.forceVideo) {
203
+ return false;
204
+ }
205
+ if (props.config.attributes.poster) {
206
+ return false;
207
+ }
208
+ return import_patterns.AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio;
209
+ }
210
+ shouldUseHLS(url) {
211
+ if (IS_SAFARI && this.props.config.forceSafariHLS || this.props.config.forceHLS) {
212
+ return true;
213
+ }
214
+ if (IS_IOS || this.props.config.forceDisableHls) {
215
+ return false;
216
+ }
217
+ return import_patterns.HLS_EXTENSIONS.test(url) || MATCH_CLOUDFLARE_STREAM.test(url);
218
+ }
219
+ shouldUseDASH(url) {
220
+ return import_patterns.DASH_EXTENSIONS.test(url) || this.props.config.forceDASH;
221
+ }
222
+ shouldUseFLV(url) {
223
+ return import_patterns.FLV_EXTENSIONS.test(url) || this.props.config.forceFLV;
224
+ }
225
+ load(url) {
226
+ const { hlsVersion, hlsOptions, dashVersion, flvVersion } = this.props.config;
227
+ if (this.hls) {
228
+ this.hls.destroy();
229
+ }
230
+ if (this.dash) {
231
+ this.dash.reset();
232
+ }
233
+ if (this.shouldUseHLS(url)) {
234
+ (0, import_utils.getSDK)(HLS_SDK_URL.replace("VERSION", hlsVersion), HLS_GLOBAL).then((Hls) => {
235
+ this.hls = new Hls(hlsOptions);
236
+ this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
237
+ this.props.onReady();
238
+ });
239
+ this.hls.on(Hls.Events.ERROR, (e, data) => {
240
+ this.props.onError(e, data, this.hls, Hls);
241
+ });
242
+ if (MATCH_CLOUDFLARE_STREAM.test(url)) {
243
+ const id = url.match(MATCH_CLOUDFLARE_STREAM)[1];
244
+ this.hls.loadSource(REPLACE_CLOUDFLARE_STREAM.replace("{id}", id));
245
+ } else {
246
+ this.hls.loadSource(url);
247
+ }
248
+ this.hls.attachMedia(this.player);
249
+ this.props.onLoaded();
250
+ });
251
+ }
252
+ if (this.shouldUseDASH(url)) {
253
+ (0, import_utils.getSDK)(DASH_SDK_URL.replace("VERSION", dashVersion), DASH_GLOBAL).then((dashjs) => {
254
+ this.dash = dashjs.MediaPlayer().create();
255
+ this.dash.initialize(this.player, url, this.props.playing);
256
+ this.dash.on("error", this.props.onError);
257
+ if (parseInt(dashVersion) < 3) {
258
+ this.dash.getDebug().setLogToBrowserConsole(false);
259
+ } else {
260
+ this.dash.updateSettings({ debug: { logLevel: dashjs.Debug.LOG_LEVEL_NONE } });
261
+ }
262
+ this.props.onLoaded();
263
+ });
264
+ }
265
+ if (this.shouldUseFLV(url)) {
266
+ (0, import_utils.getSDK)(FLV_SDK_URL.replace("VERSION", flvVersion), FLV_GLOBAL).then((flvjs) => {
267
+ this.flv = flvjs.createPlayer({ type: "flv", url });
268
+ this.flv.attachMediaElement(this.player);
269
+ this.flv.on(flvjs.Events.ERROR, (e, data) => {
270
+ this.props.onError(e, data, this.flv, flvjs);
271
+ });
272
+ this.flv.load();
273
+ this.props.onLoaded();
274
+ });
275
+ }
276
+ if (url instanceof Array) {
277
+ this.player.load();
278
+ } else if ((0, import_utils.isMediaStream)(url)) {
279
+ try {
280
+ this.player.srcObject = url;
281
+ } catch (e) {
282
+ this.player.src = window.URL.createObjectURL(url);
283
+ }
284
+ }
285
+ }
286
+ play() {
287
+ const promise = this.player.play();
288
+ if (promise) {
289
+ promise.catch(this.props.onError);
290
+ }
291
+ }
292
+ pause() {
293
+ this.player.pause();
294
+ }
295
+ stop() {
296
+ this.player.removeAttribute("src");
297
+ if (this.dash) {
298
+ this.dash.reset();
299
+ }
300
+ }
301
+ seekTo(seconds, keepPlaying = true) {
302
+ this.player.currentTime = seconds;
303
+ if (!keepPlaying) {
304
+ this.pause();
305
+ }
306
+ }
307
+ setVolume(fraction) {
308
+ this.player.volume = fraction;
309
+ }
310
+ enablePIP() {
311
+ if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) {
312
+ this.player.requestPictureInPicture();
313
+ } else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "picture-in-picture") {
314
+ this.player.webkitSetPresentationMode("picture-in-picture");
315
+ }
316
+ }
317
+ disablePIP() {
318
+ if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) {
319
+ document.exitPictureInPicture();
320
+ } else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "inline") {
321
+ this.player.webkitSetPresentationMode("inline");
322
+ }
323
+ }
324
+ setPlaybackRate(rate) {
325
+ try {
326
+ this.player.playbackRate = rate;
327
+ } catch (error) {
328
+ this.props.onError(error);
329
+ }
330
+ }
331
+ getDuration() {
332
+ if (!this.player)
333
+ return null;
334
+ const { duration, seekable } = this.player;
335
+ if (duration === Infinity && seekable.length > 0) {
336
+ return seekable.end(seekable.length - 1);
337
+ }
338
+ return duration;
339
+ }
340
+ getCurrentTime() {
341
+ if (!this.player)
342
+ return null;
343
+ return this.player.currentTime;
344
+ }
345
+ getSecondsLoaded() {
346
+ if (!this.player)
347
+ return null;
348
+ const { buffered } = this.player;
349
+ if (buffered.length === 0) {
350
+ return 0;
351
+ }
352
+ const end = buffered.end(buffered.length - 1);
353
+ const duration = this.getDuration();
354
+ if (end > duration) {
355
+ return duration;
356
+ }
357
+ return end;
358
+ }
359
+ getSource(url) {
360
+ const useHLS = this.shouldUseHLS(url);
361
+ const useDASH = this.shouldUseDASH(url);
362
+ const useFLV = this.shouldUseFLV(url);
363
+ if (url instanceof Array || (0, import_utils.isMediaStream)(url) || useHLS || useDASH || useFLV) {
364
+ return void 0;
365
+ }
366
+ if (MATCH_DROPBOX_URL.test(url)) {
367
+ return url.replace("www.dropbox.com", "dl.dropboxusercontent.com");
368
+ }
369
+ return url;
370
+ }
371
+ render() {
372
+ const { url, playing, loop, controls, muted, config, width, height } = this.props;
373
+ const useAudio = this.shouldUseAudio(this.props);
374
+ const Element = useAudio ? "audio" : "video";
375
+ const style = {
376
+ width: width === "auto" ? width : "100%",
377
+ height: height === "auto" ? height : "100%"
378
+ };
379
+ return /* @__PURE__ */ import_react.default.createElement(
380
+ Element,
381
+ {
382
+ ref: this.ref,
383
+ src: this.getSource(url),
384
+ style,
385
+ preload: "auto",
386
+ autoPlay: playing || void 0,
387
+ controls,
388
+ muted,
389
+ loop,
390
+ ...config.attributes
391
+ },
392
+ url instanceof Array && url.map(this.renderSourceElement),
393
+ config.tracks.map(this.renderTrack)
394
+ );
395
+ }
396
+ }
397
+ __publicField(FilePlayer, "displayName", "FilePlayer");
398
+ __publicField(FilePlayer, "canPlay", import_patterns.canPlay.file);
399
+ return FilePlayer_1;
400
+ }
401
+
402
+ var FilePlayerExports = /*@__PURE__*/ requireFilePlayer();
403
+ var FilePlayer = /*@__PURE__*/index.getDefaultExportFromCjs(FilePlayerExports);
404
+
405
+ var FilePlayer$1 = /*#__PURE__*/_mergeNamespaces({
406
+ __proto__: null,
407
+ default: FilePlayer
408
+ }, [FilePlayerExports]);
409
+
410
+ exports.FilePlayer = FilePlayer$1;
@@ -0,0 +1,176 @@
1
+ import { r as requireUtils, a as requirePatterns, g as getDefaultExportFromCjs } from './index-DLzCbCHu.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 Kaltura_1;
20
+ var hasRequiredKaltura;
21
+
22
+ function requireKaltura () {
23
+ if (hasRequiredKaltura) return Kaltura_1;
24
+ hasRequiredKaltura = 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 Kaltura_exports = {};
58
+ __export(Kaltura_exports, {
59
+ default: () => Kaltura
60
+ });
61
+ Kaltura_1 = __toCommonJS(Kaltura_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://cdn.embed.ly/player-0.1.0.min.js";
66
+ const SDK_GLOBAL = "playerjs";
67
+ class Kaltura 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, "secondsLoaded", null);
74
+ __publicField(this, "mute", () => {
75
+ this.callPlayer("mute");
76
+ });
77
+ __publicField(this, "unmute", () => {
78
+ this.callPlayer("unmute");
79
+ });
80
+ __publicField(this, "ref", (iframe) => {
81
+ this.iframe = iframe;
82
+ });
83
+ }
84
+ componentDidMount() {
85
+ this.props.onMount && this.props.onMount(this);
86
+ }
87
+ load(url) {
88
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((playerjs) => {
89
+ if (!this.iframe)
90
+ return;
91
+ this.player = new playerjs.Player(this.iframe);
92
+ this.player.on("ready", () => {
93
+ setTimeout(() => {
94
+ this.player.isReady = true;
95
+ this.player.setLoop(this.props.loop);
96
+ if (this.props.muted) {
97
+ this.player.mute();
98
+ }
99
+ this.addListeners(this.player, this.props);
100
+ this.props.onReady();
101
+ }, 500);
102
+ });
103
+ }, this.props.onError);
104
+ }
105
+ addListeners(player, props) {
106
+ player.on("play", props.onPlay);
107
+ player.on("pause", props.onPause);
108
+ player.on("ended", props.onEnded);
109
+ player.on("error", props.onError);
110
+ player.on("timeupdate", ({ duration, seconds }) => {
111
+ this.duration = duration;
112
+ this.currentTime = seconds;
113
+ });
114
+ }
115
+ play() {
116
+ this.callPlayer("play");
117
+ }
118
+ pause() {
119
+ this.callPlayer("pause");
120
+ }
121
+ stop() {
122
+ }
123
+ seekTo(seconds, keepPlaying = true) {
124
+ this.callPlayer("setCurrentTime", seconds);
125
+ if (!keepPlaying) {
126
+ this.pause();
127
+ }
128
+ }
129
+ setVolume(fraction) {
130
+ this.callPlayer("setVolume", fraction);
131
+ }
132
+ setLoop(loop) {
133
+ this.callPlayer("setLoop", loop);
134
+ }
135
+ getDuration() {
136
+ return this.duration;
137
+ }
138
+ getCurrentTime() {
139
+ return this.currentTime;
140
+ }
141
+ getSecondsLoaded() {
142
+ return this.secondsLoaded;
143
+ }
144
+ render() {
145
+ const style = {
146
+ width: "100%",
147
+ height: "100%"
148
+ };
149
+ return /* @__PURE__ */ import_react.default.createElement(
150
+ "iframe",
151
+ {
152
+ ref: this.ref,
153
+ src: this.props.url,
154
+ frameBorder: "0",
155
+ scrolling: "no",
156
+ style,
157
+ allow: "encrypted-media; autoplay; fullscreen;",
158
+ referrerPolicy: "no-referrer-when-downgrade"
159
+ }
160
+ );
161
+ }
162
+ }
163
+ __publicField(Kaltura, "displayName", "Kaltura");
164
+ __publicField(Kaltura, "canPlay", import_patterns.canPlay.kaltura);
165
+ return Kaltura_1;
166
+ }
167
+
168
+ var KalturaExports = /*@__PURE__*/ requireKaltura();
169
+ var Kaltura = /*@__PURE__*/getDefaultExportFromCjs(KalturaExports);
170
+
171
+ var Kaltura$1 = /*#__PURE__*/_mergeNamespaces({
172
+ __proto__: null,
173
+ default: Kaltura
174
+ }, [KalturaExports]);
175
+
176
+ export { Kaltura$1 as K };