Skip to content

Commit

Permalink
feat: use ce-la-react, fix React 19 issues (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes authored Dec 18, 2024
1 parent 6e32d36 commit 0a734e9
Show file tree
Hide file tree
Showing 29 changed files with 5,110 additions and 3,246 deletions.
6 changes: 4 additions & 2 deletions examples/nextjs/app/dash-video/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';
import DashVideo from 'dash-video-element/react';
import Player from '../player';

export const metadata: Metadata = {
title: 'Dash Video - Media Elements',
Expand All @@ -9,13 +10,14 @@ export default function Page() {
return (
<>
<section>
<DashVideo
<Player
as={DashVideo}
className="video"
src="https://player.vimeo.com/external/648359100.mpd?s=a4419a2e2113cc24a87aef2f93ef69a8e4c8fb0c"
poster="https://image.mux.com/jtWZbHQ013SLyISc9LbIGn8f4c3lWan00qOkoPMZEXmcU/thumbnail.webp?time=0"
controls
playsInline
></DashVideo>
></Player>
</section>
</>
);
Expand Down
6 changes: 3 additions & 3 deletions examples/nextjs/app/hls-video/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export default function Page(props: PageProps) {
controls
crossOrigin=""
playsInline
autoPlay={props.searchParams?.autoplay}
muted={props.searchParams?.muted}
preload={props.searchParams?.preload}
autoplay={!!props.searchParams?.autoplay}
muted={!!props.searchParams?.muted}
preload={props.searchParams?.preload as 'auto' | 'metadata' | 'none'}
suppressHydrationWarning
>
<track
Expand Down
12 changes: 10 additions & 2 deletions examples/nextjs/app/player.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
'use client';

export default function Player(props: any) {
const { as: PlayerElement, ...rest } = props;
import type React from 'react';

type PolymorphicProps<E extends React.ElementType> = React.PropsWithChildren<React.ComponentProps<E> & {
as: E;
}>;

export default function Player<T extends React.ElementType>({
as: PlayerElement,
...rest
}: PolymorphicProps<T>) {
return (
<PlayerElement
{...rest}
Expand Down
Loading

0 comments on commit 0a734e9

Please sign in to comment.