@fonixtree/magic-design 1.0.142 → 1.0.145

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 (45) hide show
  1. package/es/common/Video/index.js +4 -2
  2. package/es/common/VideoPC/background.png +0 -0
  3. package/es/common/VideoPC/closeImg.png +0 -0
  4. package/es/common/VideoPC/components/index.js +100 -0
  5. package/es/common/VideoPC/components/index.less +62 -0
  6. package/es/common/VideoPC/cover.png +0 -0
  7. package/es/common/VideoPC/index.js +748 -0
  8. package/es/common/VideoPC/index.less +79 -0
  9. package/es/common/index.js +8 -0
  10. package/es/composite-comp/dito/components/GroupedCarousel/pc/index.js +0 -1
  11. package/es/composite-comp/dito/components/SearchDITO/defaultJSON.js +2 -1
  12. package/es/composite-comp/dito/components/SearchDITO/pc/components/VideoItem/index.js +8 -2
  13. package/es/composite-comp/dito/components/SearchDITO/pc/components/VideoItem/index.less +1 -1
  14. package/es/composite-comp/dito/components/SearchDITO/pc/index.js +1 -2
  15. package/es/composite-comp/dito/components/SearchDITO/pc/index.less +1 -1
  16. package/es/composite-comp/dito/components/SlideImage/defaultJSON.js +3 -2
  17. package/es/composite-comp/dito/components/SlideImage/pc/components/CardItem/index.js +7 -2
  18. package/es/composite-comp/dito/components/SlideImage/pc/components/ParallaxScroll/index.js +5 -3
  19. package/es/composite-comp/dito/second-config-panels/SearchDITOSecondConfig/index.js +9 -0
  20. package/es/composite-comp/dito/second-config-panels/SlideImageSecondConfig/index.js +10 -1
  21. package/es/core/Renderer/index.js +0 -1
  22. package/es/utils/coreUtil.js +2 -2
  23. package/lib/common/Video/index.js +4 -2
  24. package/lib/common/VideoPC/background.png +0 -0
  25. package/lib/common/VideoPC/closeImg.png +0 -0
  26. package/lib/common/VideoPC/components/index.js +100 -0
  27. package/lib/common/VideoPC/components/index.less +62 -0
  28. package/lib/common/VideoPC/cover.png +0 -0
  29. package/lib/common/VideoPC/index.js +748 -0
  30. package/lib/common/VideoPC/index.less +79 -0
  31. package/lib/common/index.js +8 -0
  32. package/lib/composite-comp/dito/components/GroupedCarousel/pc/index.js +0 -1
  33. package/lib/composite-comp/dito/components/SearchDITO/defaultJSON.js +2 -1
  34. package/lib/composite-comp/dito/components/SearchDITO/pc/components/VideoItem/index.js +8 -2
  35. package/lib/composite-comp/dito/components/SearchDITO/pc/components/VideoItem/index.less +1 -1
  36. package/lib/composite-comp/dito/components/SearchDITO/pc/index.js +1 -2
  37. package/lib/composite-comp/dito/components/SearchDITO/pc/index.less +1 -1
  38. package/lib/composite-comp/dito/components/SlideImage/defaultJSON.js +3 -2
  39. package/lib/composite-comp/dito/components/SlideImage/pc/components/CardItem/index.js +7 -2
  40. package/lib/composite-comp/dito/components/SlideImage/pc/components/ParallaxScroll/index.js +5 -3
  41. package/lib/composite-comp/dito/second-config-panels/SearchDITOSecondConfig/index.js +9 -0
  42. package/lib/composite-comp/dito/second-config-panels/SlideImageSecondConfig/index.js +10 -1
  43. package/lib/core/Renderer/index.js +0 -1
  44. package/lib/utils/coreUtil.js +2 -2
  45. package/package.json +1 -1
@@ -0,0 +1,748 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.createVideoModal = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _components = _interopRequireDefault(require("./components"));
11
+
12
+ var _closeImg = _interopRequireDefault(require("./closeImg.png"));
13
+
14
+ var _commonUtil = require("../../utils/commonUtil");
15
+
16
+ require("./index.less");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
+
22
+ var __extends = void 0 && (void 0).__extends || function () {
23
+ var _extendStatics = function extendStatics(d, b) {
24
+ _extendStatics = Object.setPrototypeOf || {
25
+ __proto__: []
26
+ } instanceof Array && function (d, b) {
27
+ d.__proto__ = b;
28
+ } || function (d, b) {
29
+ for (var p in b) {
30
+ if (b.hasOwnProperty(p)) d[p] = b[p];
31
+ }
32
+ };
33
+
34
+ return _extendStatics(d, b);
35
+ };
36
+
37
+ return function (d, b) {
38
+ _extendStatics(d, b);
39
+
40
+ function __() {
41
+ this.constructor = d;
42
+ }
43
+
44
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45
+ };
46
+ }();
47
+
48
+ var __assign = void 0 && (void 0).__assign || function () {
49
+ __assign = Object.assign || function (t) {
50
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
51
+ s = arguments[i];
52
+
53
+ for (var p in s) {
54
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
55
+ }
56
+ }
57
+
58
+ return t;
59
+ };
60
+
61
+ return __assign.apply(this, arguments);
62
+ };
63
+
64
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
65
+ function adopt(value) {
66
+ return value instanceof P ? value : new P(function (resolve) {
67
+ resolve(value);
68
+ });
69
+ }
70
+
71
+ return new (P || (P = Promise))(function (resolve, reject) {
72
+ function fulfilled(value) {
73
+ try {
74
+ step(generator.next(value));
75
+ } catch (e) {
76
+ reject(e);
77
+ }
78
+ }
79
+
80
+ function rejected(value) {
81
+ try {
82
+ step(generator["throw"](value));
83
+ } catch (e) {
84
+ reject(e);
85
+ }
86
+ }
87
+
88
+ function step(result) {
89
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
90
+ }
91
+
92
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
93
+ });
94
+ };
95
+
96
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
97
+ var _ = {
98
+ label: 0,
99
+ sent: function sent() {
100
+ if (t[0] & 1) throw t[1];
101
+ return t[1];
102
+ },
103
+ trys: [],
104
+ ops: []
105
+ },
106
+ f,
107
+ y,
108
+ t,
109
+ g;
110
+ return g = {
111
+ next: verb(0),
112
+ "throw": verb(1),
113
+ "return": verb(2)
114
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
115
+ return this;
116
+ }), g;
117
+
118
+ function verb(n) {
119
+ return function (v) {
120
+ return step([n, v]);
121
+ };
122
+ }
123
+
124
+ function step(op) {
125
+ if (f) throw new TypeError("Generator is already executing.");
126
+
127
+ while (_) {
128
+ try {
129
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
130
+ if (y = 0, t) op = [op[0] & 2, t.value];
131
+
132
+ switch (op[0]) {
133
+ case 0:
134
+ case 1:
135
+ t = op;
136
+ break;
137
+
138
+ case 4:
139
+ _.label++;
140
+ return {
141
+ value: op[1],
142
+ done: false
143
+ };
144
+
145
+ case 5:
146
+ _.label++;
147
+ y = op[1];
148
+ op = [0];
149
+ continue;
150
+
151
+ case 7:
152
+ op = _.ops.pop();
153
+
154
+ _.trys.pop();
155
+
156
+ continue;
157
+
158
+ default:
159
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
160
+ _ = 0;
161
+ continue;
162
+ }
163
+
164
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
165
+ _.label = op[1];
166
+ break;
167
+ }
168
+
169
+ if (op[0] === 6 && _.label < t[1]) {
170
+ _.label = t[1];
171
+ t = op;
172
+ break;
173
+ }
174
+
175
+ if (t && _.label < t[2]) {
176
+ _.label = t[2];
177
+
178
+ _.ops.push(op);
179
+
180
+ break;
181
+ }
182
+
183
+ if (t[2]) _.ops.pop();
184
+
185
+ _.trys.pop();
186
+
187
+ continue;
188
+ }
189
+
190
+ op = body.call(thisArg, _);
191
+ } catch (e) {
192
+ op = [6, e];
193
+ y = 0;
194
+ } finally {
195
+ f = t = 0;
196
+ }
197
+ }
198
+
199
+ if (op[0] & 5) throw op[1];
200
+ return {
201
+ value: op[0] ? op[1] : void 0,
202
+ done: true
203
+ };
204
+ }
205
+ };
206
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
207
+
208
+
209
+ /** 检查youtube依赖包 */
210
+ var checkYoutuVIdeo = function checkYoutuVIdeo() {
211
+ return __awaiter(void 0, void 0, void 0, function () {
212
+ return __generator(this, function (_a) {
213
+ switch (_a.label) {
214
+ case 0:
215
+ if (!!window.YT) return [3
216
+ /*break*/
217
+ , 2];
218
+ return [4
219
+ /*yield*/
220
+ , Promise.all([(0, _commonUtil.importAsync)('https://www.youtube.com/iframe_api', 'js')])];
221
+
222
+ case 1:
223
+ _a.sent();
224
+
225
+ _a.label = 2;
226
+
227
+ case 2:
228
+ return [2
229
+ /*return*/
230
+ ];
231
+ }
232
+ });
233
+ });
234
+ };
235
+ /** 检查Ali依赖包 */
236
+
237
+
238
+ var checkAliVIdeo = function checkAliVIdeo() {
239
+ return __awaiter(void 0, void 0, void 0, function () {
240
+ return __generator(this, function (_a) {
241
+ switch (_a.label) {
242
+ case 0:
243
+ if (!!window.Aliplayer) return [3
244
+ /*break*/
245
+ , 2];
246
+ return [4
247
+ /*yield*/
248
+ , Promise.all([(0, _commonUtil.importAsync)('https://g.alicdn.com/de/prismplayer/2.13.2/aliplayer-min.js'), (0, _commonUtil.importAsync)('https://g.alicdn.com/de/prismplayer/2.13.2/skins/default/aliplayer-min.css')])];
249
+
250
+ case 1:
251
+ _a.sent();
252
+
253
+ _a.label = 2;
254
+
255
+ case 2:
256
+ return [2
257
+ /*return*/
258
+ ];
259
+ }
260
+ });
261
+ });
262
+ };
263
+
264
+ var createAliVideo = function createAliVideo(domId, opts) {
265
+ if (opts === void 0) {
266
+ opts = {};
267
+ }
268
+
269
+ return new Promise(function (resolve) {
270
+ var _window$Aliplayer;
271
+
272
+ var skinLayout = [{
273
+ name: 'H5Loading',
274
+ align: 'cc'
275
+ }, {
276
+ name: 'errorDisplay',
277
+ align: 'tlabs',
278
+ x: 0,
279
+ y: 0
280
+ }, {
281
+ name: 'tooltip',
282
+ align: 'blabs',
283
+ x: 0,
284
+ y: 56
285
+ }, {
286
+ name: 'thumbnail'
287
+ }];
288
+ var controlBar = {
289
+ name: 'controlBar',
290
+ align: 'blabs',
291
+ x: 0,
292
+ y: 0,
293
+ children: [{
294
+ name: 'playButton',
295
+ align: 'tl',
296
+ x: 15,
297
+ y: 12
298
+ }, {
299
+ name: 'timeDisplay',
300
+ align: 'tl',
301
+ x: 10,
302
+ y: 7
303
+ }, {
304
+ name: 'volume',
305
+ align: 'tr',
306
+ x: 5,
307
+ y: 10
308
+ }, {
309
+ name: 'fullScreenButton',
310
+ align: 'tr',
311
+ x: 10,
312
+ y: 12
313
+ }]
314
+ };
315
+ skinLayout.push(controlBar);
316
+
317
+ if (opts.progressBar) {
318
+ controlBar.children.push({
319
+ name: 'progress',
320
+ align: 'blabs',
321
+ x: 0,
322
+ y: 10
323
+ });
324
+ }
325
+
326
+ new window.Aliplayer((_window$Aliplayer = {
327
+ id: 'video' + domId,
328
+ source: opts.source,
329
+ cover: opts.cover,
330
+ width: '100%',
331
+ height: '100%',
332
+ autoplay: false,
333
+ isLive: false,
334
+ rePlay: false,
335
+ playsinline: true,
336
+ preload: true,
337
+ controlBarVisibility: opts.controlBarHide ? 'never' : 'hover',
338
+ useH5Prism: true,
339
+ skinLayout: skinLayout
340
+ }, _defineProperty(_window$Aliplayer, "autoplay", opts.autoplay), _defineProperty(_window$Aliplayer, "rePlay", opts.loop), _defineProperty(_window$Aliplayer, "components", [{
341
+ name: 'RateComponent',
342
+ type: _components["default"]
343
+ }]), _window$Aliplayer), function (player) {
344
+ if (!opts.videoSound) {
345
+ player.setVolume(0);
346
+ }
347
+
348
+ if (opts.speed) {
349
+ var speed = Number(opts.speed).toFixed(1);
350
+ player.setSpeed(speed);
351
+ player._speed = speed;
352
+ }
353
+
354
+ if (opts.startAt) {
355
+ player.seek(opts.startAt);
356
+ }
357
+
358
+ resolve(player);
359
+ });
360
+ });
361
+ };
362
+
363
+ var createYoutuVideo = function createYoutuVideo(domId, opts) {
364
+ if (opts === void 0) {
365
+ opts = {};
366
+ }
367
+
368
+ return __awaiter(void 0, void 0, void 0, function () {
369
+ var videoId;
370
+ return __generator(this, function (_a) {
371
+ switch (_a.label) {
372
+ case 0:
373
+ videoId = opts.source.split('youtu.be/')[1];
374
+ return [4
375
+ /*yield*/
376
+ , (0, _commonUtil.asyncNextTick)(function () {
377
+ return __awaiter(void 0, void 0, void 0, function () {
378
+ var player;
379
+ return __generator(this, function (_a) {
380
+ player = new YT.Player('video' + domId, {
381
+ height: '100%',
382
+ width: '100%',
383
+ videoId: videoId,
384
+ events: {
385
+ onReady: function onReady() {
386
+ if (!opts.videoSound) {
387
+ player.mute();
388
+ }
389
+
390
+ if (opts.videoSound) {
391
+ player.unMute();
392
+ }
393
+
394
+ if (opts.speed) {
395
+ player.setPlaybackRate(opts.speed);
396
+ }
397
+
398
+ if (opts.startAt) {
399
+ player.seekTo(opts.startAt);
400
+ player.pauseVideo();
401
+ }
402
+
403
+ if (opts.loop) {
404
+ player.setLoop(true);
405
+ }
406
+
407
+ if (opts.autoplay) {
408
+ player.playVideo();
409
+ }
410
+ }
411
+ }
412
+ });
413
+ return [2
414
+ /*return*/
415
+ , player];
416
+ });
417
+ });
418
+ }, 500, 10)];
419
+
420
+ case 1:
421
+ return [2
422
+ /*return*/
423
+ , _a.sent()];
424
+ }
425
+ });
426
+ });
427
+ };
428
+
429
+ var createVideo = function createVideo(type, domId, opts) {
430
+ if (opts === void 0) {
431
+ opts = {};
432
+ }
433
+
434
+ return __awaiter(void 0, void 0, void 0, function () {
435
+ return __generator(this, function (_a) {
436
+ switch (_a.label) {
437
+ case 0:
438
+ if (!(type == 'ali')) return [3
439
+ /*break*/
440
+ , 2];
441
+ return [4
442
+ /*yield*/
443
+ , createAliVideo(domId, opts)];
444
+
445
+ case 1:
446
+ return [2
447
+ /*return*/
448
+ , _a.sent()];
449
+
450
+ case 2:
451
+ if (!(type == 'youtu')) return [3
452
+ /*break*/
453
+ , 4];
454
+ return [4
455
+ /*yield*/
456
+ , createYoutuVideo(domId, opts)];
457
+
458
+ case 3:
459
+ return [2
460
+ /*return*/
461
+ , _a.sent()];
462
+
463
+ case 4:
464
+ return [2
465
+ /*return*/
466
+ ];
467
+ }
468
+ });
469
+ });
470
+ };
471
+
472
+ var getVideoType = function getVideoType(opts) {
473
+ if (/youtu/.test(opts.source)) {
474
+ return 'youtu';
475
+ }
476
+
477
+ return 'ali';
478
+ };
479
+ /** 创建视频弹框显示 */
480
+
481
+
482
+ var createVideoModal = function createVideoModal(videoId, opts) {
483
+ return __awaiter(void 0, void 0, void 0, function () {
484
+ var modelWrap, shadowWrap, contentWrap, videoDom, closeImgDom, type;
485
+ return __generator(this, function (_a) {
486
+ switch (_a.label) {
487
+ case 0:
488
+ modelWrap = document.createElement('div');
489
+ modelWrap.className = 'pc-video-modal-wrap';
490
+ modelWrap.setAttribute('video-id', videoId);
491
+ shadowWrap = document.createElement('div');
492
+ shadowWrap.className = 'video-shadow-wrap';
493
+
494
+ shadowWrap.onclick = function () {
495
+ var _a;
496
+
497
+ (_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
498
+ };
499
+
500
+ contentWrap = document.createElement('div');
501
+ contentWrap.className = 'content-wrap';
502
+ videoDom = document.createElement('div');
503
+ videoDom.id = 'video-modal-' + videoId;
504
+ contentWrap.appendChild(videoDom);
505
+ closeImgDom = document.createElement('img');
506
+ closeImgDom.src = _closeImg["default"];
507
+ closeImgDom.className = 'close-img-wrap';
508
+
509
+ closeImgDom.onclick = function () {
510
+ var _a;
511
+
512
+ (_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
513
+ };
514
+
515
+ contentWrap.appendChild(closeImgDom);
516
+ modelWrap.appendChild(shadowWrap);
517
+ modelWrap.appendChild(contentWrap);
518
+ (document.querySelector('[magic_design]') || document.body).appendChild(modelWrap);
519
+ type = getVideoType(opts);
520
+ if (!(type == 'youtu')) return [3
521
+ /*break*/
522
+ , 2];
523
+ return [4
524
+ /*yield*/
525
+ , checkYoutuVIdeo()];
526
+
527
+ case 1:
528
+ _a.sent();
529
+
530
+ _a.label = 2;
531
+
532
+ case 2:
533
+ if (!(type == 'ali')) return [3
534
+ /*break*/
535
+ , 4];
536
+ return [4
537
+ /*yield*/
538
+ , checkAliVIdeo()];
539
+
540
+ case 3:
541
+ _a.sent();
542
+
543
+ _a.label = 4;
544
+
545
+ case 4:
546
+ createVideo(type, '-modal-' + videoId, opts);
547
+ return [2
548
+ /*return*/
549
+ ];
550
+ }
551
+ });
552
+ });
553
+ };
554
+
555
+ exports.createVideoModal = createVideoModal;
556
+
557
+ var Video =
558
+ /** @class */
559
+ function (_super) {
560
+ __extends(Video, _super);
561
+
562
+ function Video() {
563
+ var _this = _super !== null && _super.apply(this, arguments) || this;
564
+
565
+ _this.state = {};
566
+ _this.player = {
567
+ play: function play() {
568
+ if (_this.aliPlayer) {
569
+ _this.aliPlayer.play();
570
+ }
571
+
572
+ if (_this.ytPlayer) {
573
+ _this.ytPlayer.playVideo();
574
+ }
575
+ },
576
+ pause: function pause() {
577
+ if (_this.aliPlayer) {
578
+ _this.aliPlayer.pause();
579
+ }
580
+
581
+ if (_this.ytPlayer) {
582
+ _this.ytPlayer.pauseVideo();
583
+ }
584
+ }
585
+ };
586
+ /** 阿里播放器 */
587
+
588
+ _this.aliPlayer = null;
589
+ /** YouTube播放器 */
590
+
591
+ _this.ytPlayer = null;
592
+ _this.timer = null;
593
+ /** 创建视频弹框显示 */
594
+
595
+ _this.createVideoModal = function (videoId) {
596
+ var modelWrap = document.createElement('div');
597
+ modelWrap.className = 'pc-video-modal-wrap';
598
+ modelWrap.setAttribute('video-id', videoId);
599
+ var shadowWrap = document.createElement('div');
600
+ shadowWrap.className = 'video-shadow-wrap';
601
+
602
+ shadowWrap.onclick = function () {
603
+ var _a;
604
+
605
+ (_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
606
+ };
607
+
608
+ var contentWrap = document.createElement('div');
609
+ contentWrap.className = 'content-wrap';
610
+ var videoDom = document.createElement('div');
611
+ videoDom.id = 'video-modal-' + videoId;
612
+ contentWrap.appendChild(videoDom);
613
+ var closeImgDom = document.createElement('img');
614
+ closeImgDom.src = _closeImg["default"];
615
+ closeImgDom.className = 'close-img-wrap';
616
+
617
+ closeImgDom.onclick = function () {
618
+ var _a;
619
+
620
+ (_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
621
+ };
622
+
623
+ contentWrap.appendChild(closeImgDom);
624
+ modelWrap.appendChild(shadowWrap);
625
+ modelWrap.appendChild(contentWrap);
626
+ (document.querySelector('[magic_design]') || document.body).appendChild(modelWrap);
627
+ var type = getVideoType(_this.props.opts);
628
+ createVideo(type, '-modal-' + videoId, __assign(__assign({}, _this.props.opts), {
629
+ autoplay: true
630
+ }));
631
+ };
632
+
633
+ _this.getInit = function () {
634
+ return __awaiter(_this, void 0, void 0, function () {
635
+ var videoType, _a, _b;
636
+
637
+ var _this = this;
638
+
639
+ return __generator(this, function (_c) {
640
+ switch (_c.label) {
641
+ case 0:
642
+ if (!this.props.opts.source) return [3
643
+ /*break*/
644
+ , 6];
645
+ videoType = getVideoType(this.props.opts);
646
+ if (!(videoType == 'youtu')) return [3
647
+ /*break*/
648
+ , 3];
649
+ return [4
650
+ /*yield*/
651
+ , checkYoutuVIdeo()];
652
+
653
+ case 1:
654
+ _c.sent();
655
+
656
+ _a = this;
657
+ return [4
658
+ /*yield*/
659
+ , createVideo('youtu', this.props.videoId, this.props.opts)];
660
+
661
+ case 2:
662
+ _a.ytPlayer = _c.sent();
663
+ this.ytPlayer.addEventListener('onStateChange', function (event) {
664
+ if (!_this.props.opts.loop) {
665
+ if (event.data == YT.PlayerState.ENDED) {
666
+ console.log('youtu end');
667
+
668
+ _this.props.onEnd();
669
+ }
670
+ }
671
+ });
672
+ _c.label = 3;
673
+
674
+ case 3:
675
+ if (!(videoType == 'ali')) return [3
676
+ /*break*/
677
+ , 6];
678
+ return [4
679
+ /*yield*/
680
+ , checkAliVIdeo()];
681
+
682
+ case 4:
683
+ _c.sent();
684
+
685
+ _b = this;
686
+ return [4
687
+ /*yield*/
688
+ , createVideo('ali', this.props.videoId, this.props.opts)];
689
+
690
+ case 5:
691
+ _b.aliPlayer = _c.sent();
692
+ this.aliPlayer.on('ended', function () {
693
+ if (!_this.props.opts.loop) {
694
+ console.log('ali end');
695
+
696
+ _this.props.onEnd();
697
+ }
698
+ });
699
+ _c.label = 6;
700
+
701
+ case 6:
702
+ return [2
703
+ /*return*/
704
+ ];
705
+ }
706
+ });
707
+ });
708
+ };
709
+
710
+ _this.fullPlay = function () {
711
+ createVideoModal(_this.props.videoId, __assign(__assign({}, _this.props.opts), {
712
+ autoplay: true
713
+ }));
714
+ };
715
+
716
+ return _this;
717
+ }
718
+
719
+ Video.prototype.componentDidMount = function () {
720
+ this.timer = setTimeout(this.getInit, 1000);
721
+ };
722
+
723
+ Video.prototype.componentWillUnmount = function () {
724
+ this.timer && clearTimeout(this.timer);
725
+ };
726
+
727
+ Video.prototype.render = function () {
728
+ var _a = this.props,
729
+ videoId = _a.videoId,
730
+ opts = _a.opts,
731
+ play = _a.play;
732
+ return /*#__PURE__*/_react["default"].createElement("div", {
733
+ className: "video-container"
734
+ }, opts.source ? /*#__PURE__*/_react["default"].createElement("div", {
735
+ className: "video-wrap",
736
+ id: 'video' + videoId
737
+ }) : null, !play && opts.cover && /*#__PURE__*/_react["default"].createElement("img", {
738
+ className: "video-cover-img",
739
+ src: opts.cover
740
+ }));
741
+ };
742
+
743
+ Video.defaultProps = {};
744
+ return Video;
745
+ }(_react["default"].Component);
746
+
747
+ var _default = Video;
748
+ exports["default"] = _default;