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/index.js CHANGED
@@ -6,7 +6,6 @@ import qs from 'qs';
6
6
  import EventEmitter from 'eventemitter3';
7
7
  import { css } from '@emotion/css';
8
8
  import * as ReactDOM from 'react-dom';
9
- import Hls from 'hls.js';
10
9
 
11
10
  /******************************************************************************
12
11
  Copyright (c) Microsoft Corporation.
@@ -9661,7 +9660,7 @@ function useOnScreen(ref) {
9661
9660
  * @Author: binruan@chatlabs.com
9662
9661
  * @Date: 2024-01-16 14:50:13
9663
9662
  * @LastEditors: binruan@chatlabs.com
9664
- * @LastEditTime: 2024-06-21 11:59:25
9663
+ * @LastEditTime: 2024-06-21 16:34:48
9665
9664
  * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
9666
9665
  *
9667
9666
  */
@@ -9677,9 +9676,12 @@ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
9677
9676
  }, rec, item, index);
9678
9677
  }
9679
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]);
9680
9682
  return (React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
9681
9683
  React.createElement("div", { ref: ref, hidden: !src, className: css({ width: '100%', height: '100%' }) },
9682
- 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 }))));
9683
9685
  };
9684
9686
  var Img$1 = memo(Img);
9685
9687
 
@@ -12882,7 +12884,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12882
12884
  return;
12883
12885
  videoRef.muted = muted;
12884
12886
  }, [muted, videoRef]);
12885
- const handleEnded = useCallback(() => {
12887
+ const handlePlay = useCallback(() => {
12886
12888
  if (!videoRef)
12887
12889
  return;
12888
12890
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
@@ -13009,15 +13011,14 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13009
13011
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
13010
13012
  if (!videoSrc)
13011
13013
  return;
13012
- if (videoSrc.includes('.m3u8')) {
13013
- if (Hls.isSupported()) {
13014
- const hls = new Hls();
13015
- hls.loadSource(videoSrc);
13016
- hls.attachMedia(videoRef);
13017
- }
13018
- else {
13019
- videoRef.src = videoSrc;
13020
- }
13014
+ const Hls = window === null || window === void 0 ? void 0 : window.Hls;
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
  */