pb-sxp-ui 1.0.90 → 1.0.92

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/pb-ui.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('eventemitter3'), require('@emotion/css'), require('react-dom'), require('hls.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', 'eventemitter3', '@emotion/css', 'react-dom', 'hls.js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.EventEmitter, global.css, global.ReactDOM, global.Hls));
5
- })(this, (function (exports, lodash, uuid$1, pako, React, qs, EventEmitter, css, ReactDOM, Hls) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('eventemitter3'), require('@emotion/css'), require('react-dom')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', 'eventemitter3', '@emotion/css', 'react-dom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.EventEmitter, global.css, global.ReactDOM));
5
+ })(this, (function (exports, lodash, uuid$1, pako, React, qs, EventEmitter, css, ReactDOM) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -9676,7 +9676,7 @@ Made in Italy` })));
9676
9676
  * @Author: binruan@chatlabs.com
9677
9677
  * @Date: 2024-01-16 14:50:13
9678
9678
  * @LastEditors: binruan@chatlabs.com
9679
- * @LastEditTime: 2024-06-21 11:59:25
9679
+ * @LastEditTime: 2024-06-21 16:34:48
9680
9680
  * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
9681
9681
  *
9682
9682
  */
@@ -9692,9 +9692,12 @@ Made in Italy` })));
9692
9692
  }, rec, item, index);
9693
9693
  }
9694
9694
  }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
9695
+ const imgSrc = React.useMemo(() => {
9696
+ return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/40`;
9697
+ }, [src]);
9695
9698
  return (React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
9696
9699
  React.createElement("div", { ref: ref, hidden: !src, className: css.css({ width: '100%', height: '100%' }) },
9697
- React.createElement(FormatImage$1, { className: css.css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: `${src}?imrquality/rquality/40` }))));
9700
+ React.createElement(FormatImage$1, { className: css.css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: imgSrc }))));
9698
9701
  };
9699
9702
  var Img$1 = React.memo(Img);
9700
9703
 
@@ -12897,7 +12900,7 @@ Made in Italy` })));
12897
12900
  return;
12898
12901
  videoRef.muted = muted;
12899
12902
  }, [muted, videoRef]);
12900
- const handleEnded = React.useCallback(() => {
12903
+ const handlePlay = React.useCallback(() => {
12901
12904
  if (!videoRef)
12902
12905
  return;
12903
12906
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
@@ -13024,15 +13027,14 @@ Made in Italy` })));
13024
13027
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
13025
13028
  if (!videoSrc)
13026
13029
  return;
13027
- if (videoSrc.includes('.m3u8')) {
13028
- if (Hls.isSupported()) {
13029
- const hls = new Hls();
13030
- hls.loadSource(videoSrc);
13031
- hls.attachMedia(videoRef);
13032
- }
13033
- else {
13034
- videoRef.src = videoSrc;
13035
- }
13030
+ const Hls = window === null || window === void 0 ? void 0 : window.Hls;
13031
+ if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
13032
+ const hls = new Hls();
13033
+ hls.loadSource(videoSrc);
13034
+ hls.attachMedia(videoRef);
13035
+ hls.on(Hls.Events.MANIFEST_PARSED, function () {
13036
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
13037
+ });
13036
13038
  }
13037
13039
  else {
13038
13040
  videoRef.src = videoSrc;
@@ -13050,14 +13052,16 @@ Made in Italy` })));
13050
13052
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
13051
13053
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
13052
13054
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
13053
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
13055
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handlePlay);
13056
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('canplay', handlePlay);
13054
13057
  return () => {
13055
13058
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
13056
13059
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
13057
13060
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
13058
13061
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
13059
13062
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
13060
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
13063
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handlePlay);
13064
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('canplay', handlePlay);
13061
13065
  };
13062
13066
  }, [isActive, videoId, rec, videoRef]);
13063
13067
  React.useEffect(() => {
@@ -13522,7 +13526,7 @@ Made in Italy` })));
13522
13526
  * @Author: binruan@chatlabs.com
13523
13527
  * @Date: 2024-01-15 19:03:09
13524
13528
  * @LastEditors: binruan@chatlabs.com
13525
- * @LastEditTime: 2024-06-21 08:56:05
13529
+ * @LastEditTime: 2024-06-21 15:53:06
13526
13530
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13527
13531
  *
13528
13532
  */