@player-ui/react 0.4.0-next.0 → 0.4.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +62 -39
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +62 -39
- package/package.json +14 -6
- package/src/player.tsx +33 -20
package/dist/index.cjs.js
CHANGED
|
@@ -14,19 +14,19 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
16
|
|
|
17
|
-
var __defProp$
|
|
18
|
-
var __getOwnPropSymbols$
|
|
19
|
-
var __hasOwnProp$
|
|
20
|
-
var __propIsEnum$
|
|
21
|
-
var __defNormalProp$
|
|
22
|
-
var __spreadValues$
|
|
17
|
+
var __defProp$4 = Object.defineProperty;
|
|
18
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
19
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
21
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
22
|
+
var __spreadValues$4 = (a, b) => {
|
|
23
23
|
for (var prop in b || (b = {}))
|
|
24
|
-
if (__hasOwnProp$
|
|
25
|
-
__defNormalProp$
|
|
26
|
-
if (__getOwnPropSymbols$
|
|
27
|
-
for (var prop of __getOwnPropSymbols$
|
|
28
|
-
if (__propIsEnum$
|
|
29
|
-
__defNormalProp$
|
|
24
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
25
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
26
|
+
if (__getOwnPropSymbols$4)
|
|
27
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
28
|
+
if (__propIsEnum$4.call(b, prop))
|
|
29
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
30
30
|
}
|
|
31
31
|
return a;
|
|
32
32
|
};
|
|
@@ -46,7 +46,7 @@ const ReactAsset = (props) => {
|
|
|
46
46
|
if (!Impl) {
|
|
47
47
|
throw Error(`No implementation found for id: ${unwrapped.id} type: ${unwrapped.type}`);
|
|
48
48
|
}
|
|
49
|
-
return /* @__PURE__ */ React__default["default"].createElement(Impl, __spreadValues$
|
|
49
|
+
return /* @__PURE__ */ React__default["default"].createElement(Impl, __spreadValues$4({}, unwrapped));
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const PlayerContext = React__default["default"].createContext({});
|
|
@@ -115,24 +115,24 @@ function useGetConstant(key) {
|
|
|
115
115
|
return player == null ? void 0 : player.constantsController.getConstants(key, "constants");
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
var __defProp$
|
|
119
|
-
var __getOwnPropSymbols$
|
|
120
|
-
var __hasOwnProp$
|
|
121
|
-
var __propIsEnum$
|
|
122
|
-
var __defNormalProp$
|
|
123
|
-
var __spreadValues$
|
|
118
|
+
var __defProp$3 = Object.defineProperty;
|
|
119
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
120
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
121
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
122
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
123
|
+
var __spreadValues$3 = (a, b) => {
|
|
124
124
|
for (var prop in b || (b = {}))
|
|
125
|
-
if (__hasOwnProp$
|
|
126
|
-
__defNormalProp$
|
|
127
|
-
if (__getOwnPropSymbols$
|
|
128
|
-
for (var prop of __getOwnPropSymbols$
|
|
129
|
-
if (__propIsEnum$
|
|
130
|
-
__defNormalProp$
|
|
125
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
126
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
127
|
+
if (__getOwnPropSymbols$3)
|
|
128
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
129
|
+
if (__propIsEnum$3.call(b, prop))
|
|
130
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
131
131
|
}
|
|
132
132
|
return a;
|
|
133
133
|
};
|
|
134
134
|
const ReactPlayer$1 = ({ view }) => {
|
|
135
|
-
return /* @__PURE__ */ React__default["default"].createElement(ReactAsset, __spreadValues$
|
|
135
|
+
return /* @__PURE__ */ React__default["default"].createElement(ReactAsset, __spreadValues$3({}, view));
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
class OnUpdatePlugin {
|
|
@@ -162,6 +162,22 @@ class OnUpdatePlugin {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
var __defProp$2 = Object.defineProperty;
|
|
166
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
167
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
168
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
169
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
170
|
+
var __spreadValues$2 = (a, b) => {
|
|
171
|
+
for (var prop in b || (b = {}))
|
|
172
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
173
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
174
|
+
if (__getOwnPropSymbols$2)
|
|
175
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
176
|
+
if (__propIsEnum$2.call(b, prop))
|
|
177
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
178
|
+
}
|
|
179
|
+
return a;
|
|
180
|
+
};
|
|
165
181
|
var __async$1 = (__this, __arguments, generator) => {
|
|
166
182
|
return new Promise((resolve, reject) => {
|
|
167
183
|
var fulfilled = (value) => {
|
|
@@ -182,8 +198,8 @@ var __async$1 = (__this, __arguments, generator) => {
|
|
|
182
198
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
183
199
|
});
|
|
184
200
|
};
|
|
185
|
-
const WEB_PLAYER_VERSION = "0.4.0-next.
|
|
186
|
-
const COMMIT = "
|
|
201
|
+
const WEB_PLAYER_VERSION = "0.4.0-next.10";
|
|
202
|
+
const COMMIT = "82270dcbee70fc05ba5b5d68e566b431ff5258ec";
|
|
187
203
|
const _window = typeof window === "undefined" ? void 0 : window;
|
|
188
204
|
class ReactPlayer {
|
|
189
205
|
constructor(options) {
|
|
@@ -213,7 +229,7 @@ class ReactPlayer {
|
|
|
213
229
|
}
|
|
214
230
|
});
|
|
215
231
|
onUpdatePlugin.apply(this.player);
|
|
216
|
-
this.Component = this.
|
|
232
|
+
this.Component = this.createReactPlayerComponent();
|
|
217
233
|
this.reactPlayerInfo = {
|
|
218
234
|
playerVersion: this.player.getVersion(),
|
|
219
235
|
playerCommit: this.player.getCommit(),
|
|
@@ -244,13 +260,9 @@ class ReactPlayer {
|
|
|
244
260
|
getReactPlayerCommit() {
|
|
245
261
|
return this.reactPlayerInfo.reactPlayerCommit;
|
|
246
262
|
}
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
const ReactPlayerComponent = () => {
|
|
250
|
-
const view = reactSubscribe.useSubscribedState(this.viewUpdateSubscription);
|
|
251
|
-
if (this.options.suspend) {
|
|
252
|
-
this.viewUpdateSubscription.suspend();
|
|
253
|
-
}
|
|
263
|
+
createReactPlayerComponent() {
|
|
264
|
+
const BaseComp = this.hooks.webComponent.call(this.createReactComp());
|
|
265
|
+
const ReactPlayerComponent = (props) => {
|
|
254
266
|
return /* @__PURE__ */ React__default["default"].createElement(reactErrorBoundary.ErrorBoundary, {
|
|
255
267
|
fallbackRender: () => null,
|
|
256
268
|
onError: (err) => {
|
|
@@ -261,15 +273,26 @@ class ReactPlayer {
|
|
|
261
273
|
}
|
|
262
274
|
}, /* @__PURE__ */ React__default["default"].createElement(PlayerContext.Provider, {
|
|
263
275
|
value: { player: this.player }
|
|
264
|
-
}, /* @__PURE__ */ React__default["default"].createElement(
|
|
276
|
+
}, /* @__PURE__ */ React__default["default"].createElement(BaseComp, __spreadValues$2({}, props))));
|
|
277
|
+
};
|
|
278
|
+
return ReactPlayerComponent;
|
|
279
|
+
}
|
|
280
|
+
createReactComp() {
|
|
281
|
+
const ActualPlayerComp = this.hooks.playerComponent.call(ReactPlayer$1);
|
|
282
|
+
const WebPlayerComponent = () => {
|
|
283
|
+
const view = reactSubscribe.useSubscribedState(this.viewUpdateSubscription);
|
|
284
|
+
if (this.options.suspend) {
|
|
285
|
+
this.viewUpdateSubscription.suspend();
|
|
286
|
+
}
|
|
287
|
+
return /* @__PURE__ */ React__default["default"].createElement(AssetContext.Provider, {
|
|
265
288
|
value: {
|
|
266
289
|
registry: this.assetRegistry
|
|
267
290
|
}
|
|
268
291
|
}, view && /* @__PURE__ */ React__default["default"].createElement(ActualPlayerComp, {
|
|
269
292
|
view
|
|
270
|
-
}))
|
|
293
|
+
}));
|
|
271
294
|
};
|
|
272
|
-
return
|
|
295
|
+
return WebPlayerComponent;
|
|
273
296
|
}
|
|
274
297
|
setWaitForNextViewUpdate() {
|
|
275
298
|
const shouldCallResetHook = this.options.suspend && this.hooks.onBeforeViewReset.isUsed();
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ declare class ReactPlayer {
|
|
|
100
100
|
getReactPlayerVersion(): string;
|
|
101
101
|
/** Returns the git commit used to build the React Player version */
|
|
102
102
|
getReactPlayerCommit(): string;
|
|
103
|
+
private createReactPlayerComponent;
|
|
103
104
|
private createReactComp;
|
|
104
105
|
/**
|
|
105
106
|
* Call this method to force the ReactPlayer to wait for the next view-update before performing the next render.
|
package/dist/index.esm.js
CHANGED
|
@@ -7,19 +7,19 @@ import { Registry } from '@player-ui/partial-match-registry';
|
|
|
7
7
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
8
8
|
import { MetricsCorePluginSymbol, RequestTimeWebPlugin } from '@player-ui/metrics-plugin';
|
|
9
9
|
|
|
10
|
-
var __defProp$
|
|
11
|
-
var __getOwnPropSymbols$
|
|
12
|
-
var __hasOwnProp$
|
|
13
|
-
var __propIsEnum$
|
|
14
|
-
var __defNormalProp$
|
|
15
|
-
var __spreadValues$
|
|
10
|
+
var __defProp$4 = Object.defineProperty;
|
|
11
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
12
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
14
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
+
var __spreadValues$4 = (a, b) => {
|
|
16
16
|
for (var prop in b || (b = {}))
|
|
17
|
-
if (__hasOwnProp$
|
|
18
|
-
__defNormalProp$
|
|
19
|
-
if (__getOwnPropSymbols$
|
|
20
|
-
for (var prop of __getOwnPropSymbols$
|
|
21
|
-
if (__propIsEnum$
|
|
22
|
-
__defNormalProp$
|
|
17
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
18
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
19
|
+
if (__getOwnPropSymbols$4)
|
|
20
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
21
|
+
if (__propIsEnum$4.call(b, prop))
|
|
22
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
23
23
|
}
|
|
24
24
|
return a;
|
|
25
25
|
};
|
|
@@ -39,7 +39,7 @@ const ReactAsset = (props) => {
|
|
|
39
39
|
if (!Impl) {
|
|
40
40
|
throw Error(`No implementation found for id: ${unwrapped.id} type: ${unwrapped.type}`);
|
|
41
41
|
}
|
|
42
|
-
return /* @__PURE__ */ React.createElement(Impl, __spreadValues$
|
|
42
|
+
return /* @__PURE__ */ React.createElement(Impl, __spreadValues$4({}, unwrapped));
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const PlayerContext = React.createContext({});
|
|
@@ -108,24 +108,24 @@ function useGetConstant(key) {
|
|
|
108
108
|
return player == null ? void 0 : player.constantsController.getConstants(key, "constants");
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
var __defProp$
|
|
112
|
-
var __getOwnPropSymbols$
|
|
113
|
-
var __hasOwnProp$
|
|
114
|
-
var __propIsEnum$
|
|
115
|
-
var __defNormalProp$
|
|
116
|
-
var __spreadValues$
|
|
111
|
+
var __defProp$3 = Object.defineProperty;
|
|
112
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
113
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
114
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
115
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
116
|
+
var __spreadValues$3 = (a, b) => {
|
|
117
117
|
for (var prop in b || (b = {}))
|
|
118
|
-
if (__hasOwnProp$
|
|
119
|
-
__defNormalProp$
|
|
120
|
-
if (__getOwnPropSymbols$
|
|
121
|
-
for (var prop of __getOwnPropSymbols$
|
|
122
|
-
if (__propIsEnum$
|
|
123
|
-
__defNormalProp$
|
|
118
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
119
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
120
|
+
if (__getOwnPropSymbols$3)
|
|
121
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
122
|
+
if (__propIsEnum$3.call(b, prop))
|
|
123
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
124
124
|
}
|
|
125
125
|
return a;
|
|
126
126
|
};
|
|
127
127
|
const ReactPlayer$1 = ({ view }) => {
|
|
128
|
-
return /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$
|
|
128
|
+
return /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$3({}, view));
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
class OnUpdatePlugin {
|
|
@@ -155,6 +155,22 @@ class OnUpdatePlugin {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
var __defProp$2 = Object.defineProperty;
|
|
159
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
160
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
161
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
162
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
163
|
+
var __spreadValues$2 = (a, b) => {
|
|
164
|
+
for (var prop in b || (b = {}))
|
|
165
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
166
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
167
|
+
if (__getOwnPropSymbols$2)
|
|
168
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
169
|
+
if (__propIsEnum$2.call(b, prop))
|
|
170
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
171
|
+
}
|
|
172
|
+
return a;
|
|
173
|
+
};
|
|
158
174
|
var __async$1 = (__this, __arguments, generator) => {
|
|
159
175
|
return new Promise((resolve, reject) => {
|
|
160
176
|
var fulfilled = (value) => {
|
|
@@ -175,8 +191,8 @@ var __async$1 = (__this, __arguments, generator) => {
|
|
|
175
191
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
176
192
|
});
|
|
177
193
|
};
|
|
178
|
-
const WEB_PLAYER_VERSION = "0.4.0-next.
|
|
179
|
-
const COMMIT = "
|
|
194
|
+
const WEB_PLAYER_VERSION = "0.4.0-next.10";
|
|
195
|
+
const COMMIT = "82270dcbee70fc05ba5b5d68e566b431ff5258ec";
|
|
180
196
|
const _window = typeof window === "undefined" ? void 0 : window;
|
|
181
197
|
class ReactPlayer {
|
|
182
198
|
constructor(options) {
|
|
@@ -206,7 +222,7 @@ class ReactPlayer {
|
|
|
206
222
|
}
|
|
207
223
|
});
|
|
208
224
|
onUpdatePlugin.apply(this.player);
|
|
209
|
-
this.Component = this.
|
|
225
|
+
this.Component = this.createReactPlayerComponent();
|
|
210
226
|
this.reactPlayerInfo = {
|
|
211
227
|
playerVersion: this.player.getVersion(),
|
|
212
228
|
playerCommit: this.player.getCommit(),
|
|
@@ -237,13 +253,9 @@ class ReactPlayer {
|
|
|
237
253
|
getReactPlayerCommit() {
|
|
238
254
|
return this.reactPlayerInfo.reactPlayerCommit;
|
|
239
255
|
}
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
const ReactPlayerComponent = () => {
|
|
243
|
-
const view = useSubscribedState(this.viewUpdateSubscription);
|
|
244
|
-
if (this.options.suspend) {
|
|
245
|
-
this.viewUpdateSubscription.suspend();
|
|
246
|
-
}
|
|
256
|
+
createReactPlayerComponent() {
|
|
257
|
+
const BaseComp = this.hooks.webComponent.call(this.createReactComp());
|
|
258
|
+
const ReactPlayerComponent = (props) => {
|
|
247
259
|
return /* @__PURE__ */ React.createElement(ErrorBoundary, {
|
|
248
260
|
fallbackRender: () => null,
|
|
249
261
|
onError: (err) => {
|
|
@@ -254,15 +266,26 @@ class ReactPlayer {
|
|
|
254
266
|
}
|
|
255
267
|
}, /* @__PURE__ */ React.createElement(PlayerContext.Provider, {
|
|
256
268
|
value: { player: this.player }
|
|
257
|
-
}, /* @__PURE__ */ React.createElement(
|
|
269
|
+
}, /* @__PURE__ */ React.createElement(BaseComp, __spreadValues$2({}, props))));
|
|
270
|
+
};
|
|
271
|
+
return ReactPlayerComponent;
|
|
272
|
+
}
|
|
273
|
+
createReactComp() {
|
|
274
|
+
const ActualPlayerComp = this.hooks.playerComponent.call(ReactPlayer$1);
|
|
275
|
+
const WebPlayerComponent = () => {
|
|
276
|
+
const view = useSubscribedState(this.viewUpdateSubscription);
|
|
277
|
+
if (this.options.suspend) {
|
|
278
|
+
this.viewUpdateSubscription.suspend();
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ React.createElement(AssetContext.Provider, {
|
|
258
281
|
value: {
|
|
259
282
|
registry: this.assetRegistry
|
|
260
283
|
}
|
|
261
284
|
}, view && /* @__PURE__ */ React.createElement(ActualPlayerComp, {
|
|
262
285
|
view
|
|
263
|
-
}))
|
|
286
|
+
}));
|
|
264
287
|
};
|
|
265
|
-
return
|
|
288
|
+
return WebPlayerComponent;
|
|
266
289
|
}
|
|
267
290
|
setWaitForNextViewUpdate() {
|
|
268
291
|
const shouldCallResetHook = this.options.suspend && this.hooks.onBeforeViewReset.isUsed();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/react",
|
|
3
|
-
"version": "0.4.0-next.
|
|
3
|
+
"version": "0.4.0-next.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"react-dom": "^17.0.2"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@player-ui/player": "0.4.0-next.
|
|
15
|
-
"@player-ui/partial-match-registry": "0.4.0-next.
|
|
16
|
-
"@player-ui/metrics-plugin": "0.4.0-next.
|
|
17
|
-
"@player-ui/react-subscribe": "0.4.0-next.
|
|
14
|
+
"@player-ui/player": "0.4.0-next.10",
|
|
15
|
+
"@player-ui/partial-match-registry": "0.4.0-next.10",
|
|
16
|
+
"@player-ui/metrics-plugin": "0.4.0-next.10",
|
|
17
|
+
"@player-ui/react-subscribe": "0.4.0-next.10",
|
|
18
18
|
"react-error-boundary": "^3.1.3",
|
|
19
|
-
"tapable-ts": "^0.2.
|
|
19
|
+
"tapable-ts": "^0.2.3",
|
|
20
20
|
"@babel/runtime": "7.15.4"
|
|
21
21
|
},
|
|
22
22
|
"main": "dist/index.cjs.js",
|
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
{
|
|
61
61
|
"name": "Kelly Harrop",
|
|
62
62
|
"url": "https://github.com/kharrop"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "Alejandro Fimbres",
|
|
66
|
+
"url": "https://github.com/lexfm"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "Rafael Campos",
|
|
70
|
+
"url": "https://github.com/rafbcampos"
|
|
63
71
|
}
|
|
64
72
|
]
|
|
65
73
|
}
|
package/src/player.tsx
CHANGED
|
@@ -19,8 +19,8 @@ import type { ReactPlayerProps } from './app';
|
|
|
19
19
|
import PlayerComp from './app';
|
|
20
20
|
import OnUpdatePlugin from './plugins/onupdate-plugin';
|
|
21
21
|
|
|
22
|
-
const WEB_PLAYER_VERSION = '0.4.0-next.
|
|
23
|
-
const COMMIT = '
|
|
22
|
+
const WEB_PLAYER_VERSION = '0.4.0-next.10';
|
|
23
|
+
const COMMIT = '82270dcbee70fc05ba5b5d68e566b431ff5258ec';
|
|
24
24
|
|
|
25
25
|
export interface DevtoolsGlobals {
|
|
26
26
|
/** A global for a plugin to load to Player for devtools */
|
|
@@ -138,7 +138,7 @@ export class ReactPlayer {
|
|
|
138
138
|
|
|
139
139
|
onUpdatePlugin.apply(this.player);
|
|
140
140
|
|
|
141
|
-
this.Component = this.
|
|
141
|
+
this.Component = this.createReactPlayerComponent();
|
|
142
142
|
this.reactPlayerInfo = {
|
|
143
143
|
playerVersion: this.player.getVersion(),
|
|
144
144
|
playerCommit: this.player.getCommit(),
|
|
@@ -182,17 +182,11 @@ export class ReactPlayer {
|
|
|
182
182
|
return this.reactPlayerInfo.reactPlayerCommit;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
private
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
/** the component to use to render Player */
|
|
189
|
-
const ReactPlayerComponent = () => {
|
|
190
|
-
const view = useSubscribedState<View>(this.viewUpdateSubscription);
|
|
191
|
-
|
|
192
|
-
if (this.options.suspend) {
|
|
193
|
-
this.viewUpdateSubscription.suspend();
|
|
194
|
-
}
|
|
185
|
+
private createReactPlayerComponent(): React.ComponentType<ReactPlayerComponentProps> {
|
|
186
|
+
const BaseComp = this.hooks.webComponent.call(this.createReactComp());
|
|
195
187
|
|
|
188
|
+
/** Wrap the Error boundary and context provider after the hook call to catch anything wrapped by the hook */
|
|
189
|
+
const ReactPlayerComponent = (props: ReactPlayerComponentProps) => {
|
|
196
190
|
return (
|
|
197
191
|
<ErrorBoundary
|
|
198
192
|
fallbackRender={() => null}
|
|
@@ -205,13 +199,7 @@ export class ReactPlayer {
|
|
|
205
199
|
}}
|
|
206
200
|
>
|
|
207
201
|
<PlayerContext.Provider value={{ player: this.player }}>
|
|
208
|
-
<
|
|
209
|
-
value={{
|
|
210
|
-
registry: this.assetRegistry,
|
|
211
|
-
}}
|
|
212
|
-
>
|
|
213
|
-
{view && <ActualPlayerComp view={view} />}
|
|
214
|
-
</AssetContext.Provider>
|
|
202
|
+
<BaseComp {...props} />
|
|
215
203
|
</PlayerContext.Provider>
|
|
216
204
|
</ErrorBoundary>
|
|
217
205
|
);
|
|
@@ -220,6 +208,31 @@ export class ReactPlayer {
|
|
|
220
208
|
return ReactPlayerComponent;
|
|
221
209
|
}
|
|
222
210
|
|
|
211
|
+
private createReactComp(): React.ComponentType<ReactPlayerComponentProps> {
|
|
212
|
+
const ActualPlayerComp = this.hooks.playerComponent.call(PlayerComp);
|
|
213
|
+
|
|
214
|
+
/** the component to use to render the player */
|
|
215
|
+
const WebPlayerComponent = () => {
|
|
216
|
+
const view = useSubscribedState<View>(this.viewUpdateSubscription);
|
|
217
|
+
|
|
218
|
+
if (this.options.suspend) {
|
|
219
|
+
this.viewUpdateSubscription.suspend();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<AssetContext.Provider
|
|
224
|
+
value={{
|
|
225
|
+
registry: this.assetRegistry,
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
{view && <ActualPlayerComp view={view} />}
|
|
229
|
+
</AssetContext.Provider>
|
|
230
|
+
);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
return WebPlayerComponent;
|
|
234
|
+
}
|
|
235
|
+
|
|
223
236
|
/**
|
|
224
237
|
* Call this method to force the ReactPlayer to wait for the next view-update before performing the next render.
|
|
225
238
|
* If the `suspense` option is set, this will suspend while an update is pending, otherwise nothing will be rendered.
|