@appquality/unguess-design-system 3.1.103 → 3.1.104
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# v3.1.104 (Tue Jul 02 2024)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- pipPlayer + chat improvements [#402](https://github.com/AppQuality/unguess-design-system/pull/402) ([@Kariamos](https://github.com/Kariamos) [@iacopolea](https://github.com/iacopolea) [@marcbon](https://github.com/marcbon) [@sinatragianpaolo](https://github.com/sinatragianpaolo))
|
|
6
|
+
- feat: Add Picture-in-Picture functionality to Player component [#400](https://github.com/AppQuality/unguess-design-system/pull/400) ([@iacopolea](https://github.com/iacopolea))
|
|
7
|
+
- fix: avatar type in the attachments lightbox is now the same as the a… [#401](https://github.com/AppQuality/unguess-design-system/pull/401) ([@Kariamos](https://github.com/Kariamos))
|
|
8
|
+
|
|
9
|
+
#### Authors: 4
|
|
10
|
+
|
|
11
|
+
- Gianpaolo Sinatra ([@sinatragianpaolo](https://github.com/sinatragianpaolo))
|
|
12
|
+
- Iacopo Leardini ([@iacopolea](https://github.com/iacopolea))
|
|
13
|
+
- Marco ([@Kariamos](https://github.com/Kariamos))
|
|
14
|
+
- Marco Bonomo ([@marcbon](https://github.com/marcbon))
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
1
18
|
# v3.1.103 (Fri Jun 28 2024)
|
|
2
19
|
|
|
3
20
|
#### 🐛 Bug Fix
|
package/build/index.js
CHANGED
|
@@ -4780,6 +4780,79 @@ const StyledDiv = styled__default["default"].div `
|
|
|
4780
4780
|
`;
|
|
4781
4781
|
const VideoSpinner = () => (jsxRuntime.jsx(StyledDiv, { children: jsxRuntime.jsx(Spinner, { size: "50", color: "white" }) }));
|
|
4782
4782
|
|
|
4783
|
+
const usePictureInPicture = (videoRef, pipMode, onPipChange) => {
|
|
4784
|
+
const getObserver = (videoRef, isVideoPlaying) => {
|
|
4785
|
+
return new IntersectionObserver((entries) => {
|
|
4786
|
+
entries.forEach((entry) => {
|
|
4787
|
+
if (!entry.isIntersecting && isVideoPlaying()) {
|
|
4788
|
+
videoRef.requestPictureInPicture();
|
|
4789
|
+
}
|
|
4790
|
+
if (document.pictureInPictureElement &&
|
|
4791
|
+
entry.isIntersecting &&
|
|
4792
|
+
!isVideoPlaying()) {
|
|
4793
|
+
document.exitPictureInPicture();
|
|
4794
|
+
}
|
|
4795
|
+
});
|
|
4796
|
+
}, { threshold: 0.5 });
|
|
4797
|
+
};
|
|
4798
|
+
const handleManualPipMode = (videoRef, pipMode) => {
|
|
4799
|
+
if (pipMode) {
|
|
4800
|
+
videoRef.requestPictureInPicture();
|
|
4801
|
+
}
|
|
4802
|
+
if (!pipMode && document.pictureInPictureElement) {
|
|
4803
|
+
document.exitPictureInPicture();
|
|
4804
|
+
}
|
|
4805
|
+
};
|
|
4806
|
+
React.useEffect(() => {
|
|
4807
|
+
// bail out if pipMode is not defined or videoRef is not defined or pip is not supported
|
|
4808
|
+
if (typeof pipMode === "undefined")
|
|
4809
|
+
return;
|
|
4810
|
+
if (!document.pictureInPictureEnabled) {
|
|
4811
|
+
console.warn("Picture-in-Picture is not supported in this browser");
|
|
4812
|
+
return;
|
|
4813
|
+
}
|
|
4814
|
+
if (!videoRef)
|
|
4815
|
+
return;
|
|
4816
|
+
// if pipMode is auto, we will enter picture in picture mode when the video is not in view
|
|
4817
|
+
if (pipMode === "auto") {
|
|
4818
|
+
const isVideoPlaying = () => videoRef.currentTime > 0 &&
|
|
4819
|
+
!videoRef.paused &&
|
|
4820
|
+
!videoRef.ended &&
|
|
4821
|
+
videoRef.readyState > 2;
|
|
4822
|
+
const observer = getObserver(videoRef, isVideoPlaying);
|
|
4823
|
+
observer.observe(videoRef);
|
|
4824
|
+
return () => {
|
|
4825
|
+
observer.disconnect();
|
|
4826
|
+
};
|
|
4827
|
+
}
|
|
4828
|
+
else if (typeof pipMode === "boolean") {
|
|
4829
|
+
handleManualPipMode(videoRef, pipMode);
|
|
4830
|
+
}
|
|
4831
|
+
else {
|
|
4832
|
+
handleManualPipMode(videoRef, pipMode());
|
|
4833
|
+
}
|
|
4834
|
+
}, [pipMode, videoRef]);
|
|
4835
|
+
React.useEffect(() => {
|
|
4836
|
+
if (!document.pictureInPictureEnabled) {
|
|
4837
|
+
return;
|
|
4838
|
+
}
|
|
4839
|
+
document.addEventListener("enterpictureinpicture", () => {
|
|
4840
|
+
onPipChange === null || onPipChange === void 0 ? void 0 : onPipChange(true);
|
|
4841
|
+
});
|
|
4842
|
+
document.addEventListener("leavepictureinpicture", () => {
|
|
4843
|
+
onPipChange === null || onPipChange === void 0 ? void 0 : onPipChange(false);
|
|
4844
|
+
});
|
|
4845
|
+
return () => {
|
|
4846
|
+
document.removeEventListener("enterpictureinpicture", () => {
|
|
4847
|
+
onPipChange === null || onPipChange === void 0 ? void 0 : onPipChange(true);
|
|
4848
|
+
});
|
|
4849
|
+
document.removeEventListener("leavepictureinpicture", () => {
|
|
4850
|
+
onPipChange === null || onPipChange === void 0 ? void 0 : onPipChange(false);
|
|
4851
|
+
});
|
|
4852
|
+
};
|
|
4853
|
+
}, [onPipChange]);
|
|
4854
|
+
};
|
|
4855
|
+
|
|
4783
4856
|
/**
|
|
4784
4857
|
* The Player is a styled media tag with custom controls
|
|
4785
4858
|
* <hr>
|
|
@@ -4790,13 +4863,14 @@ const Player = React.forwardRef((props, forwardRef) => (jsxRuntime.jsx(Video__de
|
|
|
4790
4863
|
const PlayerCore = React.forwardRef((props, forwardRef) => {
|
|
4791
4864
|
var _a;
|
|
4792
4865
|
const { context, togglePlay, setIsPlaying } = Video.useVideoContext();
|
|
4793
|
-
const { onCutHandler, bookmarks, isCutting } = props;
|
|
4866
|
+
const { onCutHandler, bookmarks, isCutting, pipMode, onPipChange } = props;
|
|
4794
4867
|
const videoRef = (_a = context.player) === null || _a === void 0 ? void 0 : _a.ref.current;
|
|
4795
4868
|
const isLoaded = !!videoRef;
|
|
4796
4869
|
const containerRef = React.useRef(null);
|
|
4797
4870
|
React.useImperativeHandle(forwardRef, () => videoRef, [
|
|
4798
4871
|
videoRef,
|
|
4799
4872
|
]);
|
|
4873
|
+
usePictureInPicture(videoRef, pipMode, onPipChange);
|
|
4800
4874
|
React.useEffect(() => {
|
|
4801
4875
|
if (videoRef) {
|
|
4802
4876
|
videoRef.addEventListener("pause", () => {
|
|
@@ -4999,6 +5073,7 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
|
|
|
4999
5073
|
handleClickThumbnail(index);
|
|
5000
5074
|
} }) }), index))) })) }), jsxRuntime.jsx(MediaLightBox, { isOpen: isOpen, header: jsxRuntime.jsxs(reactTypography.MD, Object.assign({ isBold: true }, { children: [jsxRuntime.jsx(Grey600Span, { children: header && header.title }), header && header.message && (jsxRuntime.jsxs(Grey800Span, { children: [" | ", header.message] }))] })), onClose: closeLightbox, slideChange: slideChange, selectedImageIndex: selectedImageIndex, thumbnails: media, videoRefs: videoRefs, details: jsxRuntime.jsx(Comment, Object.assign({ header: header, author: {
|
|
5001
5075
|
avatar: author.avatar,
|
|
5076
|
+
avatarType: author.avatarType,
|
|
5002
5077
|
name: author.name,
|
|
5003
5078
|
}, date: date, message: message }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("br", {}) }) })) }), jsxRuntime.jsx(Footer$2, { children: children })] }));
|
|
5004
5079
|
};
|
|
@@ -3,7 +3,8 @@ export interface PlayerArgs extends HTMLAttributes<HTMLVideoElement> {
|
|
|
3
3
|
url: string;
|
|
4
4
|
start?: number;
|
|
5
5
|
end?: number;
|
|
6
|
-
|
|
6
|
+
pipMode?: "auto" | (() => boolean) | boolean;
|
|
7
|
+
onPipChange?: (isPip: boolean) => void;
|
|
7
8
|
onCutHandler?: (time: number) => void;
|
|
8
9
|
isCutting?: boolean;
|
|
9
10
|
bookmarks?: IBookmark[];
|
|
@@ -2,6 +2,8 @@ import { PlayerArgs } from "./_types";
|
|
|
2
2
|
interface PlayerStoryArgs extends PlayerArgs {
|
|
3
3
|
}
|
|
4
4
|
export declare const Basic: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, PlayerStoryArgs>;
|
|
5
|
+
export declare const AutoPip: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, PlayerStoryArgs>;
|
|
6
|
+
export declare const ButtonPip: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, PlayerStoryArgs>;
|
|
5
7
|
export declare const Streaming: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, PlayerStoryArgs>;
|
|
6
8
|
export declare const WithBookmarks: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, PlayerStoryArgs>;
|
|
7
9
|
export declare const WithContext: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, PlayerStoryArgs>;
|