pb-sxp-ui 1.0.91 → 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/index.cjs CHANGED
@@ -9683,7 +9683,7 @@ function useOnScreen(ref) {
9683
9683
  * @Author: binruan@chatlabs.com
9684
9684
  * @Date: 2024-01-16 14:50:13
9685
9685
  * @LastEditors: binruan@chatlabs.com
9686
- * @LastEditTime: 2024-06-21 11:59:25
9686
+ * @LastEditTime: 2024-06-21 16:34:48
9687
9687
  * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
9688
9688
  *
9689
9689
  */
@@ -9699,9 +9699,12 @@ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
9699
9699
  }, rec, item, index);
9700
9700
  }
9701
9701
  }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
9702
+ const imgSrc = React.useMemo(() => {
9703
+ return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/40`;
9704
+ }, [src]);
9702
9705
  return (React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
9703
9706
  React.createElement("div", { ref: ref, hidden: !src, className: css.css({ width: '100%', height: '100%' }) },
9704
- 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` }))));
9707
+ 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 }))));
9705
9708
  };
9706
9709
  var Img$1 = React.memo(Img);
9707
9710
 
@@ -12904,7 +12907,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12904
12907
  return;
12905
12908
  videoRef.muted = muted;
12906
12909
  }, [muted, videoRef]);
12907
- const handleEnded = React.useCallback(() => {
12910
+ const handlePlay = React.useCallback(() => {
12908
12911
  if (!videoRef)
12909
12912
  return;
12910
12913
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
@@ -13032,15 +13035,13 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13032
13035
  if (!videoSrc)
13033
13036
  return;
13034
13037
  const Hls = window === null || window === void 0 ? void 0 : window.Hls;
13035
- if (videoSrc.includes('.m3u8')) {
13036
- if (Hls && Hls.isSupported()) {
13037
- const hls = new Hls();
13038
- hls.loadSource(videoSrc);
13039
- hls.attachMedia(videoRef);
13040
- }
13041
- else {
13042
- videoRef.src = videoSrc;
13043
- }
13038
+ if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
13039
+ const hls = new Hls();
13040
+ hls.loadSource(videoSrc);
13041
+ hls.attachMedia(videoRef);
13042
+ hls.on(Hls.Events.MANIFEST_PARSED, function () {
13043
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
13044
+ });
13044
13045
  }
13045
13046
  else {
13046
13047
  videoRef.src = videoSrc;
@@ -13058,14 +13059,16 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13058
13059
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
13059
13060
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
13060
13061
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
13061
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
13062
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handlePlay);
13063
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('canplay', handlePlay);
13062
13064
  return () => {
13063
13065
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
13064
13066
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
13065
13067
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
13066
13068
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
13067
13069
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
13068
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
13070
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handlePlay);
13071
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('canplay', handlePlay);
13069
13072
  };
13070
13073
  }, [isActive, videoId, rec, videoRef]);
13071
13074
  React.useEffect(() => {
@@ -13530,7 +13533,7 @@ var Tagbar$1 = React.memo(Tagbar);
13530
13533
  * @Author: binruan@chatlabs.com
13531
13534
  * @Date: 2024-01-15 19:03:09
13532
13535
  * @LastEditors: binruan@chatlabs.com
13533
- * @LastEditTime: 2024-06-21 08:56:05
13536
+ * @LastEditTime: 2024-06-21 15:53:06
13534
13537
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13535
13538
  *
13536
13539
  */