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.
Files changed (96) hide show
  1. package/dist/{components/DailyMotion-B7yDPBbg.js → DailyMotion-DacNkqsi.js} +1 -1
  2. package/dist/{components/DailyMotion-BmnymjR1.esm.js → DailyMotion-gaY-1HqX.esm.js} +1 -1
  3. package/dist/{components/Facebook-D9Ak6ZJU.esm.js → Facebook-C_tH1Bi_.esm.js} +1 -1
  4. package/dist/{components/Facebook-42iqQU2G.js → Facebook-D4wLMJkY.js} +1 -1
  5. package/dist/{components/FilePlayer-CAnHK0Cd.js → FilePlayer-B4s5OcYq.js} +1 -1
  6. package/dist/{components/FilePlayer-wg9lyafD.esm.js → FilePlayer-DqR2mvGK.esm.js} +1 -1
  7. package/dist/{components/Kaltura-DPaEN-dq.esm.js → Kaltura-C9QbmEfO.esm.js} +1 -1
  8. package/dist/{components/Kaltura-Ct6kwbgP.js → Kaltura-kCqUZWuf.js} +1 -1
  9. package/dist/{components/Mixcloud-sBbcL5rG.js → Mixcloud-2c71b3Nf.js} +1 -1
  10. package/dist/{components/Mixcloud-BobSN3YI.esm.js → Mixcloud-ib_DIXF1.esm.js} +1 -1
  11. package/dist/{components/Mux-Cosy8sFO.js → Mux-BsXgGo6C.js} +1 -1
  12. package/dist/{components/Mux-B9YP-rFr.esm.js → Mux-CJ6kEh1R.esm.js} +1 -1
  13. package/dist/{components/Preview-DiVfo6aa.js → Preview-gEkhA4mX.js} +1 -1
  14. package/dist/{components/Preview-XcTlhHT1.esm.js → Preview-kqr7fWet.esm.js} +1 -1
  15. package/dist/{components/SoundCloud-CIWqB-QW.js → SoundCloud-BWup2g--.js} +1 -1
  16. package/dist/{components/SoundCloud-BTHoyFWT.esm.js → SoundCloud-DJM0bsQG.esm.js} +1 -1
  17. package/dist/{components/Streamable-DsfQCy3p.esm.js → Streamable-CJltauTy.esm.js} +1 -1
  18. package/dist/{components/Streamable-9anYiQtU.js → Streamable-UeTHV2nZ.js} +1 -1
  19. package/dist/{components/Twitch-D1BOr8hj.esm.js → Twitch-C9qq_89Q.esm.js} +1 -1
  20. package/dist/{components/Twitch-Dud6e1Rv.js → Twitch-_N8mEsiS.js} +1 -1
  21. package/dist/{components/Vidyard-BuOu85uS.js → Vidyard-CQuxB99Z.js} +1 -1
  22. package/dist/{components/Vidyard-C1csjpQH.esm.js → Vidyard-gtcLQdYd.esm.js} +1 -1
  23. package/dist/{components/Vimeo-CHlHIswX.esm.js → Vimeo-Dzp5eoLi.esm.js} +1 -1
  24. package/dist/{components/Vimeo-DrDJ5O9H.js → Vimeo-nhXVoFTb.js} +1 -1
  25. package/dist/{components/Wistia-fh9U2CA2.js → Wistia-C1DqA9IW.js} +1 -1
  26. package/dist/{components/Wistia-D-eYyONb.esm.js → Wistia-DV3BO3z9.esm.js} +1 -1
  27. package/dist/{components/YouTube-CmnnzZvk.esm.js → YouTube-BKwvJCnt.esm.js} +1 -1
  28. package/dist/{components/YouTube-DC2uZ14c.js → YouTube-DDou5phH.js} +1 -1
  29. package/dist/components/CourseCard/CourseCard.styles.d.ts +1 -1
  30. package/dist/components/DailyMotion-B8IJNjSc.js +180 -0
  31. package/dist/components/DailyMotion-COg3zgIZ.esm.js +178 -0
  32. package/dist/components/Facebook-DJ7a3Bj8.js +181 -0
  33. package/dist/components/Facebook-NS80Vk6j.esm.js +179 -0
  34. package/dist/components/FilePlayer-D-fc3B0E.esm.js +408 -0
  35. package/dist/components/FilePlayer-SyLt5qGX.js +410 -0
  36. package/dist/components/Kaltura-BTFxSMxP.js +178 -0
  37. package/dist/components/Kaltura-CmFIWSef.esm.js +176 -0
  38. package/dist/components/Mixcloud-CO5MsWUJ.esm.js +164 -0
  39. package/dist/components/Mixcloud-DHAfVpcc.js +166 -0
  40. package/dist/components/Mux-C8-HithD.esm.js +264 -0
  41. package/dist/components/Mux-bycDxP8G.js +266 -0
  42. package/dist/components/Preview-Clg3y6sj.esm.js +173 -0
  43. package/dist/components/Preview-CzpcknZI.js +175 -0
  44. package/dist/components/SoundCloud-Dz9DeIIM.js +183 -0
  45. package/dist/components/SoundCloud-LfWEBVy1.esm.js +181 -0
  46. package/dist/components/Streamable-BpcVhi4M.esm.js +174 -0
  47. package/dist/components/Streamable-Cs_c-7jS.js +176 -0
  48. package/dist/components/Twitch-BJ9aSIM2.esm.js +168 -0
  49. package/dist/components/Twitch-C9bksXF6.js +170 -0
  50. package/dist/components/VideoPlayer/PiPContext.d.ts +8 -0
  51. package/dist/components/VideoPlayer/PiPContext.js +149 -0
  52. package/dist/components/VideoPlayer/PiPContext.js.map +1 -0
  53. package/dist/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  54. package/dist/components/VideoPlayer/PiPContext.types.js +2 -0
  55. package/dist/components/VideoPlayer/PiPContext.types.js.map +1 -0
  56. package/dist/components/VideoPlayer/usePiP.d.ts +2 -0
  57. package/dist/components/VideoPlayer/usePiP.js +10 -0
  58. package/dist/components/VideoPlayer/usePiP.js.map +1 -0
  59. package/dist/components/VideoPlayer/usePlayerControls.js +46 -64
  60. package/dist/components/VideoPlayer/usePlayerControls.js.map +1 -1
  61. package/dist/components/Vidyard-CsUFSBXh.js +174 -0
  62. package/dist/components/Vidyard-Dc8NHJ7p.esm.js +172 -0
  63. package/dist/components/Vimeo-CwlScNtK.esm.js +213 -0
  64. package/dist/components/Vimeo-D6C93592.js +215 -0
  65. package/dist/components/Wistia-Bxvdn3oO.js +190 -0
  66. package/dist/components/Wistia-Cwl4fNWW.esm.js +188 -0
  67. package/dist/components/YouTube-BF85SRPF.js +260 -0
  68. package/dist/components/YouTube-DKkYzN7-.esm.js +258 -0
  69. package/dist/components/components/CourseCard/CourseCard.styles.d.ts +1 -1
  70. package/dist/components/components/VideoPlayer/PiPContext.d.ts +8 -0
  71. package/dist/components/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  72. package/dist/components/components/VideoPlayer/usePiP.d.ts +2 -0
  73. package/dist/components/components/index.d.ts +2 -0
  74. package/dist/components/{index-DetZ05pw.js → index-C08W0lXg.js} +157 -295
  75. package/dist/components/{index-DKAGRUEW.esm.js → index-F6zEoSWf.esm.js} +156 -296
  76. package/dist/components/index.d.ts +2 -0
  77. package/dist/components/index.esm.js +1 -1
  78. package/dist/components/index.js +2 -0
  79. package/dist/components/index.js.map +1 -1
  80. package/dist/icons/components/CourseCard/CourseCard.styles.d.ts +1 -1
  81. package/dist/icons/components/VideoPlayer/PiPContext.d.ts +8 -0
  82. package/dist/icons/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  83. package/dist/icons/components/VideoPlayer/usePiP.d.ts +2 -0
  84. package/dist/icons/components/index.d.ts +2 -0
  85. package/dist/index-CcTTuhg8.esm.js +94920 -0
  86. package/dist/index-Dq4qpx9F.js +95142 -0
  87. package/dist/index.d.ts +2 -0
  88. package/dist/index.esm.js +3 -3
  89. package/dist/index.js +3 -0
  90. package/dist/index.js.map +1 -1
  91. package/package.json +1 -1
  92. package/dist/components/VideoPlayer/pipManager.d.ts +0 -60
  93. package/dist/components/VideoPlayer/pipManager.js +0 -272
  94. package/dist/components/VideoPlayer/pipManager.js.map +0 -1
  95. package/dist/components/components/VideoPlayer/pipManager.d.ts +0 -60
  96. package/dist/icons/components/VideoPlayer/pipManager.d.ts +0 -60
@@ -0,0 +1,174 @@
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 Streamable_1;
20
+ var hasRequiredStreamable;
21
+
22
+ function requireStreamable () {
23
+ if (hasRequiredStreamable) return Streamable_1;
24
+ hasRequiredStreamable = 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 Streamable_exports = {};
58
+ __export(Streamable_exports, {
59
+ default: () => Streamable
60
+ });
61
+ Streamable_1 = __toCommonJS(Streamable_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 Streamable 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.setLoop(this.props.loop);
93
+ this.player.on("ready", this.props.onReady);
94
+ this.player.on("play", this.props.onPlay);
95
+ this.player.on("pause", this.props.onPause);
96
+ this.player.on("seeked", this.props.onSeek);
97
+ this.player.on("ended", this.props.onEnded);
98
+ this.player.on("error", this.props.onError);
99
+ this.player.on("timeupdate", ({ duration, seconds }) => {
100
+ this.duration = duration;
101
+ this.currentTime = seconds;
102
+ });
103
+ this.player.on("buffered", ({ percent }) => {
104
+ if (this.duration) {
105
+ this.secondsLoaded = this.duration * percent;
106
+ }
107
+ });
108
+ if (this.props.muted) {
109
+ this.player.mute();
110
+ }
111
+ }, this.props.onError);
112
+ }
113
+ play() {
114
+ this.callPlayer("play");
115
+ }
116
+ pause() {
117
+ this.callPlayer("pause");
118
+ }
119
+ stop() {
120
+ }
121
+ seekTo(seconds, keepPlaying = true) {
122
+ this.callPlayer("setCurrentTime", seconds);
123
+ if (!keepPlaying) {
124
+ this.pause();
125
+ }
126
+ }
127
+ setVolume(fraction) {
128
+ this.callPlayer("setVolume", fraction * 100);
129
+ }
130
+ setLoop(loop) {
131
+ this.callPlayer("setLoop", loop);
132
+ }
133
+ getDuration() {
134
+ return this.duration;
135
+ }
136
+ getCurrentTime() {
137
+ return this.currentTime;
138
+ }
139
+ getSecondsLoaded() {
140
+ return this.secondsLoaded;
141
+ }
142
+ render() {
143
+ const id = this.props.url.match(import_patterns.MATCH_URL_STREAMABLE)[1];
144
+ const style = {
145
+ width: "100%",
146
+ height: "100%"
147
+ };
148
+ return /* @__PURE__ */ import_react.default.createElement(
149
+ "iframe",
150
+ {
151
+ ref: this.ref,
152
+ src: `https://streamable.com/o/${id}`,
153
+ frameBorder: "0",
154
+ scrolling: "no",
155
+ style,
156
+ allow: "encrypted-media; autoplay; fullscreen;"
157
+ }
158
+ );
159
+ }
160
+ }
161
+ __publicField(Streamable, "displayName", "Streamable");
162
+ __publicField(Streamable, "canPlay", import_patterns.canPlay.streamable);
163
+ return Streamable_1;
164
+ }
165
+
166
+ var StreamableExports = /*@__PURE__*/ requireStreamable();
167
+ var Streamable = /*@__PURE__*/getDefaultExportFromCjs(StreamableExports);
168
+
169
+ var Streamable$1 = /*#__PURE__*/_mergeNamespaces({
170
+ __proto__: null,
171
+ default: Streamable
172
+ }, [StreamableExports]);
173
+
174
+ export { Streamable$1 as S };
@@ -0,0 +1,176 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C08W0lXg.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 Streamable_1;
22
+ var hasRequiredStreamable;
23
+
24
+ function requireStreamable () {
25
+ if (hasRequiredStreamable) return Streamable_1;
26
+ hasRequiredStreamable = 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 Streamable_exports = {};
60
+ __export(Streamable_exports, {
61
+ default: () => Streamable
62
+ });
63
+ Streamable_1 = __toCommonJS(Streamable_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://cdn.embed.ly/player-0.1.0.min.js";
68
+ const SDK_GLOBAL = "playerjs";
69
+ class Streamable extends import_react.Component {
70
+ constructor() {
71
+ super(...arguments);
72
+ __publicField(this, "callPlayer", import_utils.callPlayer);
73
+ __publicField(this, "duration", null);
74
+ __publicField(this, "currentTime", null);
75
+ __publicField(this, "secondsLoaded", null);
76
+ __publicField(this, "mute", () => {
77
+ this.callPlayer("mute");
78
+ });
79
+ __publicField(this, "unmute", () => {
80
+ this.callPlayer("unmute");
81
+ });
82
+ __publicField(this, "ref", (iframe) => {
83
+ this.iframe = iframe;
84
+ });
85
+ }
86
+ componentDidMount() {
87
+ this.props.onMount && this.props.onMount(this);
88
+ }
89
+ load(url) {
90
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((playerjs) => {
91
+ if (!this.iframe)
92
+ return;
93
+ this.player = new playerjs.Player(this.iframe);
94
+ this.player.setLoop(this.props.loop);
95
+ this.player.on("ready", this.props.onReady);
96
+ this.player.on("play", this.props.onPlay);
97
+ this.player.on("pause", this.props.onPause);
98
+ this.player.on("seeked", this.props.onSeek);
99
+ this.player.on("ended", this.props.onEnded);
100
+ this.player.on("error", this.props.onError);
101
+ this.player.on("timeupdate", ({ duration, seconds }) => {
102
+ this.duration = duration;
103
+ this.currentTime = seconds;
104
+ });
105
+ this.player.on("buffered", ({ percent }) => {
106
+ if (this.duration) {
107
+ this.secondsLoaded = this.duration * percent;
108
+ }
109
+ });
110
+ if (this.props.muted) {
111
+ this.player.mute();
112
+ }
113
+ }, this.props.onError);
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 * 100);
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 id = this.props.url.match(import_patterns.MATCH_URL_STREAMABLE)[1];
146
+ const style = {
147
+ width: "100%",
148
+ height: "100%"
149
+ };
150
+ return /* @__PURE__ */ import_react.default.createElement(
151
+ "iframe",
152
+ {
153
+ ref: this.ref,
154
+ src: `https://streamable.com/o/${id}`,
155
+ frameBorder: "0",
156
+ scrolling: "no",
157
+ style,
158
+ allow: "encrypted-media; autoplay; fullscreen;"
159
+ }
160
+ );
161
+ }
162
+ }
163
+ __publicField(Streamable, "displayName", "Streamable");
164
+ __publicField(Streamable, "canPlay", import_patterns.canPlay.streamable);
165
+ return Streamable_1;
166
+ }
167
+
168
+ var StreamableExports = /*@__PURE__*/ requireStreamable();
169
+ var Streamable = /*@__PURE__*/index.getDefaultExportFromCjs(StreamableExports);
170
+
171
+ var Streamable$1 = /*#__PURE__*/_mergeNamespaces({
172
+ __proto__: null,
173
+ default: Streamable
174
+ }, [StreamableExports]);
175
+
176
+ exports.Streamable = Streamable$1;
@@ -0,0 +1,168 @@
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 Twitch_1;
20
+ var hasRequiredTwitch;
21
+
22
+ function requireTwitch () {
23
+ if (hasRequiredTwitch) return Twitch_1;
24
+ hasRequiredTwitch = 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 Twitch_exports = {};
58
+ __export(Twitch_exports, {
59
+ default: () => Twitch
60
+ });
61
+ Twitch_1 = __toCommonJS(Twitch_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://player.twitch.tv/js/embed/v1.js";
66
+ const SDK_GLOBAL = "Twitch";
67
+ const PLAYER_ID_PREFIX = "twitch-player-";
68
+ class Twitch extends import_react.Component {
69
+ constructor() {
70
+ super(...arguments);
71
+ __publicField(this, "callPlayer", import_utils.callPlayer);
72
+ __publicField(this, "playerID", this.props.config.playerId || `${PLAYER_ID_PREFIX}${(0, import_utils.randomString)()}`);
73
+ __publicField(this, "mute", () => {
74
+ this.callPlayer("setMuted", true);
75
+ });
76
+ __publicField(this, "unmute", () => {
77
+ this.callPlayer("setMuted", false);
78
+ });
79
+ }
80
+ componentDidMount() {
81
+ this.props.onMount && this.props.onMount(this);
82
+ }
83
+ load(url, isReady) {
84
+ const { playsinline, onError, config, controls } = this.props;
85
+ const isChannel = import_patterns.MATCH_URL_TWITCH_CHANNEL.test(url);
86
+ const id = isChannel ? url.match(import_patterns.MATCH_URL_TWITCH_CHANNEL)[1] : url.match(import_patterns.MATCH_URL_TWITCH_VIDEO)[1];
87
+ if (isReady) {
88
+ if (isChannel) {
89
+ this.player.setChannel(id);
90
+ } else {
91
+ this.player.setVideo("v" + id);
92
+ }
93
+ return;
94
+ }
95
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((Twitch2) => {
96
+ this.player = new Twitch2.Player(this.playerID, {
97
+ video: isChannel ? "" : id,
98
+ channel: isChannel ? id : "",
99
+ height: "100%",
100
+ width: "100%",
101
+ playsinline,
102
+ autoplay: this.props.playing,
103
+ muted: this.props.muted,
104
+ // https://github.com/CookPete/react-player/issues/733#issuecomment-549085859
105
+ controls: isChannel ? true : controls,
106
+ time: (0, import_utils.parseStartTime)(url),
107
+ ...config.options
108
+ });
109
+ const { READY, PLAYING, PAUSE, ENDED, ONLINE, OFFLINE, SEEK } = Twitch2.Player;
110
+ this.player.addEventListener(READY, this.props.onReady);
111
+ this.player.addEventListener(PLAYING, this.props.onPlay);
112
+ this.player.addEventListener(PAUSE, this.props.onPause);
113
+ this.player.addEventListener(ENDED, this.props.onEnded);
114
+ this.player.addEventListener(SEEK, this.props.onSeek);
115
+ this.player.addEventListener(ONLINE, this.props.onLoaded);
116
+ this.player.addEventListener(OFFLINE, this.props.onLoaded);
117
+ }, onError);
118
+ }
119
+ play() {
120
+ this.callPlayer("play");
121
+ }
122
+ pause() {
123
+ this.callPlayer("pause");
124
+ }
125
+ stop() {
126
+ this.callPlayer("pause");
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("getCurrentTime");
142
+ }
143
+ getSecondsLoaded() {
144
+ return null;
145
+ }
146
+ render() {
147
+ const style = {
148
+ width: "100%",
149
+ height: "100%"
150
+ };
151
+ return /* @__PURE__ */ import_react.default.createElement("div", { style, id: this.playerID });
152
+ }
153
+ }
154
+ __publicField(Twitch, "displayName", "Twitch");
155
+ __publicField(Twitch, "canPlay", import_patterns.canPlay.twitch);
156
+ __publicField(Twitch, "loopOnEnded", true);
157
+ return Twitch_1;
158
+ }
159
+
160
+ var TwitchExports = /*@__PURE__*/ requireTwitch();
161
+ var Twitch = /*@__PURE__*/getDefaultExportFromCjs(TwitchExports);
162
+
163
+ var Twitch$1 = /*#__PURE__*/_mergeNamespaces({
164
+ __proto__: null,
165
+ default: Twitch
166
+ }, [TwitchExports]);
167
+
168
+ export { Twitch$1 as T };
@@ -0,0 +1,170 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C08W0lXg.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 Twitch_1;
22
+ var hasRequiredTwitch;
23
+
24
+ function requireTwitch () {
25
+ if (hasRequiredTwitch) return Twitch_1;
26
+ hasRequiredTwitch = 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 Twitch_exports = {};
60
+ __export(Twitch_exports, {
61
+ default: () => Twitch
62
+ });
63
+ Twitch_1 = __toCommonJS(Twitch_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://player.twitch.tv/js/embed/v1.js";
68
+ const SDK_GLOBAL = "Twitch";
69
+ const PLAYER_ID_PREFIX = "twitch-player-";
70
+ class Twitch extends import_react.Component {
71
+ constructor() {
72
+ super(...arguments);
73
+ __publicField(this, "callPlayer", import_utils.callPlayer);
74
+ __publicField(this, "playerID", this.props.config.playerId || `${PLAYER_ID_PREFIX}${(0, import_utils.randomString)()}`);
75
+ __publicField(this, "mute", () => {
76
+ this.callPlayer("setMuted", true);
77
+ });
78
+ __publicField(this, "unmute", () => {
79
+ this.callPlayer("setMuted", false);
80
+ });
81
+ }
82
+ componentDidMount() {
83
+ this.props.onMount && this.props.onMount(this);
84
+ }
85
+ load(url, isReady) {
86
+ const { playsinline, onError, config, controls } = this.props;
87
+ const isChannel = import_patterns.MATCH_URL_TWITCH_CHANNEL.test(url);
88
+ const id = isChannel ? url.match(import_patterns.MATCH_URL_TWITCH_CHANNEL)[1] : url.match(import_patterns.MATCH_URL_TWITCH_VIDEO)[1];
89
+ if (isReady) {
90
+ if (isChannel) {
91
+ this.player.setChannel(id);
92
+ } else {
93
+ this.player.setVideo("v" + id);
94
+ }
95
+ return;
96
+ }
97
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((Twitch2) => {
98
+ this.player = new Twitch2.Player(this.playerID, {
99
+ video: isChannel ? "" : id,
100
+ channel: isChannel ? id : "",
101
+ height: "100%",
102
+ width: "100%",
103
+ playsinline,
104
+ autoplay: this.props.playing,
105
+ muted: this.props.muted,
106
+ // https://github.com/CookPete/react-player/issues/733#issuecomment-549085859
107
+ controls: isChannel ? true : controls,
108
+ time: (0, import_utils.parseStartTime)(url),
109
+ ...config.options
110
+ });
111
+ const { READY, PLAYING, PAUSE, ENDED, ONLINE, OFFLINE, SEEK } = Twitch2.Player;
112
+ this.player.addEventListener(READY, this.props.onReady);
113
+ this.player.addEventListener(PLAYING, this.props.onPlay);
114
+ this.player.addEventListener(PAUSE, this.props.onPause);
115
+ this.player.addEventListener(ENDED, this.props.onEnded);
116
+ this.player.addEventListener(SEEK, this.props.onSeek);
117
+ this.player.addEventListener(ONLINE, this.props.onLoaded);
118
+ this.player.addEventListener(OFFLINE, this.props.onLoaded);
119
+ }, onError);
120
+ }
121
+ play() {
122
+ this.callPlayer("play");
123
+ }
124
+ pause() {
125
+ this.callPlayer("pause");
126
+ }
127
+ stop() {
128
+ this.callPlayer("pause");
129
+ }
130
+ seekTo(seconds, keepPlaying = true) {
131
+ this.callPlayer("seek", seconds);
132
+ if (!keepPlaying) {
133
+ this.pause();
134
+ }
135
+ }
136
+ setVolume(fraction) {
137
+ this.callPlayer("setVolume", fraction);
138
+ }
139
+ getDuration() {
140
+ return this.callPlayer("getDuration");
141
+ }
142
+ getCurrentTime() {
143
+ return this.callPlayer("getCurrentTime");
144
+ }
145
+ getSecondsLoaded() {
146
+ return null;
147
+ }
148
+ render() {
149
+ const style = {
150
+ width: "100%",
151
+ height: "100%"
152
+ };
153
+ return /* @__PURE__ */ import_react.default.createElement("div", { style, id: this.playerID });
154
+ }
155
+ }
156
+ __publicField(Twitch, "displayName", "Twitch");
157
+ __publicField(Twitch, "canPlay", import_patterns.canPlay.twitch);
158
+ __publicField(Twitch, "loopOnEnded", true);
159
+ return Twitch_1;
160
+ }
161
+
162
+ var TwitchExports = /*@__PURE__*/ requireTwitch();
163
+ var Twitch = /*@__PURE__*/index.getDefaultExportFromCjs(TwitchExports);
164
+
165
+ var Twitch$1 = /*#__PURE__*/_mergeNamespaces({
166
+ __proto__: null,
167
+ default: Twitch
168
+ }, [TwitchExports]);
169
+
170
+ exports.Twitch = Twitch$1;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { PiPContextType } from './PiPContext.types';
3
+ export declare const PiPContext: React.Context<PiPContextType | undefined>;
4
+ interface PiPProviderProps {
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const PiPProvider: React.FC<PiPProviderProps>;
8
+ export {};