Skip to content

Commit

Permalink
Merge pull request #93 from whereby/thomas/PAN-349-add-mirror-support
Browse files Browse the repository at this point in the history
Add mirror support
  • Loading branch information
thyal authored Oct 20, 2023
2 parents 057f556 + 12d9b4f commit ea96fc6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@whereby.com/browser-sdk",
"version": "2.0.0-alpha27",
"version": "2.0.0-alpha26",
"description": "Modules for integration Whereby video in web apps",
"author": "Whereby AS",
"license": "MIT",
Expand Down
13 changes: 11 additions & 2 deletions src/lib/react/VideoView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import debounce from "../utils/debounce";
interface VideoViewSelfProps {
stream: MediaStream;
muted?: boolean;
mirror?: boolean;
style?: React.CSSProperties;
onResize?: ({ width, height, stream }: { width: number; height: number; stream: MediaStream }) => void;
}

type VideoViewProps = VideoViewSelfProps &
React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;

export default ({ muted, stream, onResize, ...rest }: VideoViewProps) => {
export default ({ muted, mirror = false, stream, onResize, ...rest }: VideoViewProps) => {
const videoEl = useRef<HTMLVideoElement>(null);

useEffect(() => {
Expand Down Expand Up @@ -57,5 +58,13 @@ export default ({ muted, stream, onResize, ...rest }: VideoViewProps) => {
}
}, [muted, stream, videoEl]);

return <video ref={videoEl} autoPlay playsInline {...rest} />;
return (
<video
ref={videoEl}
autoPlay
playsInline
{...rest}
style={{ transform: mirror ? "scaleX(-1)" : "none", ...rest.style }}
/>
);
};

0 comments on commit ea96fc6

Please sign in to comment.