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.js CHANGED
@@ -9660,7 +9660,7 @@ function useOnScreen(ref) {
9660
9660
  * @Author: binruan@chatlabs.com
9661
9661
  * @Date: 2024-01-16 14:50:13
9662
9662
  * @LastEditors: binruan@chatlabs.com
9663
- * @LastEditTime: 2024-06-21 11:59:25
9663
+ * @LastEditTime: 2024-06-21 16:34:48
9664
9664
  * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
9665
9665
  *
9666
9666
  */
@@ -9676,9 +9676,12 @@ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
9676
9676
  }, rec, item, index);
9677
9677
  }
9678
9678
  }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
9679
+ const imgSrc = useMemo(() => {
9680
+ return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/40`;
9681
+ }, [src]);
9679
9682
  return (React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
9680
9683
  React.createElement("div", { ref: ref, hidden: !src, className: css({ width: '100%', height: '100%' }) },
9681
- React.createElement(FormatImage$1, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: `${src}?imrquality/rquality/40` }))));
9684
+ React.createElement(FormatImage$1, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: imgSrc }))));
9682
9685
  };
9683
9686
  var Img$1 = memo(Img);
9684
9687
 
@@ -12881,7 +12884,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12881
12884
  return;
12882
12885
  videoRef.muted = muted;
12883
12886
  }, [muted, videoRef]);
12884
- const handleEnded = useCallback(() => {
12887
+ const handlePlay = useCallback(() => {
12885
12888
  if (!videoRef)
12886
12889
  return;
12887
12890
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
@@ -13009,15 +13012,13 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13009
13012
  if (!videoSrc)
13010
13013
  return;
13011
13014
  const Hls = window === null || window === void 0 ? void 0 : window.Hls;
13012
- if (videoSrc.includes('.m3u8')) {
13013
- if (Hls && Hls.isSupported()) {
13014
- const hls = new Hls();
13015
- hls.loadSource(videoSrc);
13016
- hls.attachMedia(videoRef);
13017
- }
13018
- else {
13019
- videoRef.src = videoSrc;
13020
- }
13015
+ if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
13016
+ const hls = new Hls();
13017
+ hls.loadSource(videoSrc);
13018
+ hls.attachMedia(videoRef);
13019
+ hls.on(Hls.Events.MANIFEST_PARSED, function () {
13020
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
13021
+ });
13021
13022
  }
13022
13023
  else {
13023
13024
  videoRef.src = videoSrc;
@@ -13035,14 +13036,16 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13035
13036
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
13036
13037
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
13037
13038
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
13038
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
13039
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handlePlay);
13040
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('canplay', handlePlay);
13039
13041
  return () => {
13040
13042
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
13041
13043
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
13042
13044
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
13043
13045
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
13044
13046
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
13045
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
13047
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handlePlay);
13048
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('canplay', handlePlay);
13046
13049
  };
13047
13050
  }, [isActive, videoId, rec, videoRef]);
13048
13051
  useEffect(() => {
@@ -13507,7 +13510,7 @@ var Tagbar$1 = memo(Tagbar);
13507
13510
  * @Author: binruan@chatlabs.com
13508
13511
  * @Date: 2024-01-15 19:03:09
13509
13512
  * @LastEditors: binruan@chatlabs.com
13510
- * @LastEditTime: 2024-06-21 08:56:05
13513
+ * @LastEditTime: 2024-06-21 15:53:06
13511
13514
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13512
13515
  *
13513
13516
  */