Skip to content

Commit

Permalink
fix player sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
sphinxrave committed Jun 9, 2024
1 parent fea90c5 commit a0c9dbd
Show file tree
Hide file tree
Showing 3 changed files with 561 additions and 676 deletions.
12 changes: 5 additions & 7 deletions packages/react/src/components/layout/PlayerWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@ export const PlayerWrapper = ({
ref={customSetPlayerRef ?? setPlayerRef}
// pass `key` to prevent flicker issue https://github.com/CookPete/react-player/issues/413#issuecomment-395404630
key={url}
style={
{
// aspectRatio: "16 / 9", uncommenting this may cause the aspect ratio to lock on certain pages such as script editor
}
}
// width="100%"
width="auto"
style={{
aspectRatio: "16 / 9", //uncommenting this may cause the aspect ratio to lock on certain pages such as script editor
}}
width="100%"
// width="auto"
height="100%"
url={url}
controls
Expand Down
10 changes: 3 additions & 7 deletions packages/react/src/routes/watch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default function Watch() {
const chatPos = useAtomValue(chatPosAtom);
const [ref, bounds] = useMeasure({ debounce: 50, scroll: false });

const url = idToVideoURL(id, currentVideo?.link);
return (
<>
<Helmet>
Expand Down Expand Up @@ -88,7 +89,7 @@ export default function Watch() {
>
<PlayerWrapper
id={currentVideo?.id}
url={currentVideo?.link}
url={url}
// className="h-full w-full"
// style={{ aspectRatio: theaterMode ? "" : "16 / 9" }}
/>
Expand All @@ -99,12 +100,7 @@ export default function Watch() {
)}
</div>
)}
{currentVideo && (
<Controlbar
video={currentVideo}
url={idToVideoURL(currentVideo.id, currentVideo.link)}
/>
)}
{currentVideo && <Controlbar video={currentVideo} url={url} />}
</div>
<div
className={cn("flex flex-col gap-1", {
Expand Down
1,215 changes: 553 additions & 662 deletions packages/react/videos.tldr

Large diffs are not rendered by default.

0 comments on commit a0c9dbd

Please sign in to comment.