@galacean/effects-plugin-multimedia 2.8.0-alpha.2 → 2.8.0-alpha.4

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.
@@ -1,8 +1,8 @@
1
1
  import type { Scene, SceneLoadOptions } from '@galacean/effects';
2
- import { AbstractPlugin } from '@galacean/effects';
2
+ import { Plugin } from '@galacean/effects';
3
3
  /**
4
4
  * 音频加载插件
5
5
  */
6
- export declare class AudioLoader extends AbstractPlugin {
7
- processAssets(scene: Scene, options?: SceneLoadOptions): Promise<void>;
6
+ export declare class AudioLoader extends Plugin {
7
+ onAssetsLoadStart(scene: Scene, options?: SceneLoadOptions): Promise<void>;
8
8
  }
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player multimedia plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 云垣
6
- * Version: v2.8.0-alpha.2
6
+ * Version: v2.8.0-alpha.4
7
7
  */
8
8
 
9
9
  'use strict';
@@ -81,6 +81,74 @@ function _inherits(subClass, superClass) {
81
81
  if (superClass) _set_prototype_of(subClass, superClass);
82
82
  }
83
83
 
84
+ function _is_native_reflect_construct() {
85
+ // Since Reflect.construct can't be properly polyfilled, some
86
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
87
+ // Those polyfills don't allow us to subclass built-ins, so we need to
88
+ // use our fallback implementation.
89
+ try {
90
+ // If the internal slots aren't set, this throws an error similar to
91
+ // TypeError: this is not a Boolean object.
92
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
93
+ } catch (_) {}
94
+ return (_is_native_reflect_construct = function _is_native_reflect_construct() {
95
+ return !!result;
96
+ })();
97
+ }
98
+
99
+ function _construct(Parent, args, Class) {
100
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
101
+ else {
102
+ _construct = function construct(Parent, args, Class) {
103
+ var a = [
104
+ null
105
+ ];
106
+ a.push.apply(a, args);
107
+ var Constructor = Function.bind.apply(Parent, a);
108
+ var instance = new Constructor();
109
+ if (Class) _set_prototype_of(instance, Class.prototype);
110
+ return instance;
111
+ };
112
+ }
113
+ return _construct.apply(null, arguments);
114
+ }
115
+
116
+ function _get_prototype_of(o) {
117
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
118
+ return o.__proto__ || Object.getPrototypeOf(o);
119
+ };
120
+ return _get_prototype_of(o);
121
+ }
122
+
123
+ function _is_native_function(fn) {
124
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
125
+ }
126
+
127
+ function _wrap_native_super(Class) {
128
+ var _cache = typeof Map === "function" ? new Map() : undefined;
129
+ _wrap_native_super = function _wrap_native_super(Class) {
130
+ if (Class === null || !_is_native_function(Class)) return Class;
131
+ if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
132
+ if (typeof _cache !== "undefined") {
133
+ if (_cache.has(Class)) return _cache.get(Class);
134
+ _cache.set(Class, Wrapper);
135
+ }
136
+ function Wrapper() {
137
+ return _construct(Class, arguments, _get_prototype_of(this).constructor);
138
+ }
139
+ Wrapper.prototype = Object.create(Class.prototype, {
140
+ constructor: {
141
+ value: Wrapper,
142
+ enumerable: false,
143
+ writable: true,
144
+ configurable: true
145
+ }
146
+ });
147
+ return _set_prototype_of(Wrapper, Class);
148
+ };
149
+ return _wrap_native_super(Class);
150
+ }
151
+
84
152
  function _instanceof1(left, right) {
85
153
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
86
154
  return !!right[Symbol.hasInstance](left);
@@ -194,74 +262,6 @@ function _assert_this_initialized(self) {
194
262
  return self;
195
263
  }
196
264
 
197
- function _is_native_reflect_construct() {
198
- // Since Reflect.construct can't be properly polyfilled, some
199
- // implementations (e.g. core-js@2) don't set the correct internal slots.
200
- // Those polyfills don't allow us to subclass built-ins, so we need to
201
- // use our fallback implementation.
202
- try {
203
- // If the internal slots aren't set, this throws an error similar to
204
- // TypeError: this is not a Boolean object.
205
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
206
- } catch (_) {}
207
- return (_is_native_reflect_construct = function _is_native_reflect_construct() {
208
- return !!result;
209
- })();
210
- }
211
-
212
- function _construct(Parent, args, Class) {
213
- if (_is_native_reflect_construct()) _construct = Reflect.construct;
214
- else {
215
- _construct = function construct(Parent, args, Class) {
216
- var a = [
217
- null
218
- ];
219
- a.push.apply(a, args);
220
- var Constructor = Function.bind.apply(Parent, a);
221
- var instance = new Constructor();
222
- if (Class) _set_prototype_of(instance, Class.prototype);
223
- return instance;
224
- };
225
- }
226
- return _construct.apply(null, arguments);
227
- }
228
-
229
- function _get_prototype_of(o) {
230
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
231
- return o.__proto__ || Object.getPrototypeOf(o);
232
- };
233
- return _get_prototype_of(o);
234
- }
235
-
236
- function _is_native_function(fn) {
237
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
238
- }
239
-
240
- function _wrap_native_super(Class) {
241
- var _cache = typeof Map === "function" ? new Map() : undefined;
242
- _wrap_native_super = function _wrap_native_super(Class) {
243
- if (Class === null || !_is_native_function(Class)) return Class;
244
- if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
245
- if (typeof _cache !== "undefined") {
246
- if (_cache.has(Class)) return _cache.get(Class);
247
- _cache.set(Class, Wrapper);
248
- }
249
- function Wrapper() {
250
- return _construct(Class, arguments, _get_prototype_of(this).constructor);
251
- }
252
- Wrapper.prototype = Object.create(Class.prototype, {
253
- constructor: {
254
- value: Wrapper,
255
- enumerable: false,
256
- writable: true,
257
- configurable: true
258
- }
259
- });
260
- return _set_prototype_of(Wrapper, Class);
261
- };
262
- return _wrap_native_super(Class);
263
- }
264
-
265
265
  var multimediaErrorMessageMap = {
266
266
  2000: "Autoplay permission for audio and video is not enabled"
267
267
  };
@@ -433,13 +433,13 @@ var MultimediaError = /*#__PURE__*/ function(Error1) {
433
433
 
434
434
  /**
435
435
  * 视频加载插件
436
- */ var VideoLoader = /*#__PURE__*/ function(AbstractPlugin) {
437
- _inherits(VideoLoader, AbstractPlugin);
436
+ */ var VideoLoader = /*#__PURE__*/ function(Plugin) {
437
+ _inherits(VideoLoader, Plugin);
438
438
  function VideoLoader() {
439
- return AbstractPlugin.apply(this, arguments);
439
+ return Plugin.apply(this, arguments);
440
440
  }
441
441
  var _proto = VideoLoader.prototype;
442
- _proto.processAssets = function processAssets(scene, options) {
442
+ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
443
443
  if (options === void 0) options = {};
444
444
  return _async_to_generator(function() {
445
445
  var _scene_jsonScene, _scene_jsonScene_videos, videos, loadedAssets, i, video;
@@ -465,17 +465,17 @@ var MultimediaError = /*#__PURE__*/ function(Error1) {
465
465
  })();
466
466
  };
467
467
  return VideoLoader;
468
- }(EFFECTS.AbstractPlugin);
468
+ }(_wrap_native_super(EFFECTS.Plugin));
469
469
 
470
470
  /**
471
471
  * 音频加载插件
472
- */ var AudioLoader = /*#__PURE__*/ function(AbstractPlugin) {
473
- _inherits(AudioLoader, AbstractPlugin);
472
+ */ var AudioLoader = /*#__PURE__*/ function(Plugin) {
473
+ _inherits(AudioLoader, Plugin);
474
474
  function AudioLoader() {
475
- return AbstractPlugin.apply(this, arguments);
475
+ return Plugin.apply(this, arguments);
476
476
  }
477
477
  var _proto = AudioLoader.prototype;
478
- _proto.processAssets = function processAssets(scene, options) {
478
+ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
479
479
  if (options === void 0) options = {};
480
480
  return _async_to_generator(function() {
481
481
  var _scene_jsonScene, _scene_jsonScene_audios, audios, loadedAssets, i, audio;
@@ -501,7 +501,7 @@ var MultimediaError = /*#__PURE__*/ function(Error1) {
501
501
  })();
502
502
  };
503
503
  return AudioLoader;
504
- }(EFFECTS.AbstractPlugin);
504
+ }(_wrap_native_super(EFFECTS.Plugin));
505
505
 
506
506
  var seed = 0;
507
507
  exports.VideoComponent = /*#__PURE__*/ function(MaskableGraphic) {
@@ -1142,7 +1142,7 @@ exports.AudioComponent = __decorate([
1142
1142
 
1143
1143
  /**
1144
1144
  * 插件版本号
1145
- */ var version = "2.8.0-alpha.2";
1145
+ */ var version = "2.8.0-alpha.4";
1146
1146
  EFFECTS.registerPlugin("video", VideoLoader);
1147
1147
  EFFECTS.registerPlugin("audio", AudioLoader);
1148
1148
  EFFECTS.logger.info("Plugin multimedia version: " + version + ".");