suada-components 1.0.2504170948 → 1.1.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.
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,181 @@
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 Facebook_1;
22
+ var hasRequiredFacebook;
23
+
24
+ function requireFacebook () {
25
+ if (hasRequiredFacebook) return Facebook_1;
26
+ hasRequiredFacebook = 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 Facebook_exports = {};
60
+ __export(Facebook_exports, {
61
+ default: () => Facebook
62
+ });
63
+ Facebook_1 = __toCommonJS(Facebook_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://connect.facebook.net/en_US/sdk.js";
68
+ const SDK_GLOBAL = "FB";
69
+ const SDK_GLOBAL_READY = "fbAsyncInit";
70
+ const PLAYER_ID_PREFIX = "facebook-player-";
71
+ class Facebook extends import_react.Component {
72
+ constructor() {
73
+ super(...arguments);
74
+ __publicField(this, "callPlayer", import_utils.callPlayer);
75
+ __publicField(this, "playerID", this.props.config.playerId || `${PLAYER_ID_PREFIX}${(0, import_utils.randomString)()}`);
76
+ __publicField(this, "mute", () => {
77
+ this.callPlayer("mute");
78
+ });
79
+ __publicField(this, "unmute", () => {
80
+ this.callPlayer("unmute");
81
+ });
82
+ }
83
+ componentDidMount() {
84
+ this.props.onMount && this.props.onMount(this);
85
+ }
86
+ load(url, isReady) {
87
+ if (isReady) {
88
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then((FB) => FB.XFBML.parse());
89
+ return;
90
+ }
91
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then((FB) => {
92
+ FB.init({
93
+ appId: this.props.config.appId,
94
+ xfbml: true,
95
+ version: this.props.config.version
96
+ });
97
+ FB.Event.subscribe("xfbml.render", (msg) => {
98
+ this.props.onLoaded();
99
+ });
100
+ FB.Event.subscribe("xfbml.ready", (msg) => {
101
+ if (msg.type === "video" && msg.id === this.playerID) {
102
+ this.player = msg.instance;
103
+ this.player.subscribe("startedPlaying", this.props.onPlay);
104
+ this.player.subscribe("paused", this.props.onPause);
105
+ this.player.subscribe("finishedPlaying", this.props.onEnded);
106
+ this.player.subscribe("startedBuffering", this.props.onBuffer);
107
+ this.player.subscribe("finishedBuffering", this.props.onBufferEnd);
108
+ this.player.subscribe("error", this.props.onError);
109
+ if (this.props.muted) {
110
+ this.callPlayer("mute");
111
+ } else {
112
+ this.callPlayer("unmute");
113
+ }
114
+ this.props.onReady();
115
+ document.getElementById(this.playerID).querySelector("iframe").style.visibility = "visible";
116
+ }
117
+ });
118
+ });
119
+ }
120
+ play() {
121
+ this.callPlayer("play");
122
+ }
123
+ pause() {
124
+ this.callPlayer("pause");
125
+ }
126
+ stop() {
127
+ }
128
+ seekTo(seconds, keepPlaying = true) {
129
+ this.callPlayer("seek", seconds);
130
+ if (!keepPlaying) {
131
+ this.pause();
132
+ }
133
+ }
134
+ setVolume(fraction) {
135
+ this.callPlayer("setVolume", fraction);
136
+ }
137
+ getDuration() {
138
+ return this.callPlayer("getDuration");
139
+ }
140
+ getCurrentTime() {
141
+ return this.callPlayer("getCurrentPosition");
142
+ }
143
+ getSecondsLoaded() {
144
+ return null;
145
+ }
146
+ render() {
147
+ const { attributes } = this.props.config;
148
+ const style = {
149
+ width: "100%",
150
+ height: "100%"
151
+ };
152
+ return /* @__PURE__ */ import_react.default.createElement(
153
+ "div",
154
+ {
155
+ style,
156
+ id: this.playerID,
157
+ className: "fb-video",
158
+ "data-href": this.props.url,
159
+ "data-autoplay": this.props.playing ? "true" : "false",
160
+ "data-allowfullscreen": "true",
161
+ "data-controls": this.props.controls ? "true" : "false",
162
+ ...attributes
163
+ }
164
+ );
165
+ }
166
+ }
167
+ __publicField(Facebook, "displayName", "Facebook");
168
+ __publicField(Facebook, "canPlay", import_patterns.canPlay.facebook);
169
+ __publicField(Facebook, "loopOnEnded", true);
170
+ return Facebook_1;
171
+ }
172
+
173
+ var FacebookExports = /*@__PURE__*/ requireFacebook();
174
+ var Facebook = /*@__PURE__*/index.getDefaultExportFromCjs(FacebookExports);
175
+
176
+ var Facebook$1 = /*#__PURE__*/_mergeNamespaces({
177
+ __proto__: null,
178
+ default: Facebook
179
+ }, [FacebookExports]);
180
+
181
+ exports.Facebook = Facebook$1;
@@ -0,0 +1,408 @@
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 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 };