Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

with-mux-video: updates for next 15 compat #74881

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions examples/with-mux-video/app/(upload)/asset/[assetId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ const checkAssetStatus = async (assetId: string): Promise<Status> => {
// For this example, calling the Mux API on each request and then polling is sufficient.
export const dynamic = "force-dynamic";

export default async function Page({
params: { assetId },
}: {
params: { assetId: string };
}) {
export default async function Page(
props: {
params: Promise<{ assetId: string }>;
}
) {
const params = await props.params;

const {
assetId
} = params;

const initialStatus = await checkAssetStatus(assetId);
return (
<AssetStatusPoll
Expand Down
60 changes: 35 additions & 25 deletions examples/with-mux-video/app/v/[playbackId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,35 @@ type Params = {
};

const title = "View this video created with Mux + Next.js";
export const generateMetadata = ({ params }: { params: Params }) => ({
title,
description: undefined,
openGraph: {
title,
images: [
{
url: `https://image.mux.com/${params.playbackId}/thumbnail.png?width=1200&height=630&fit_mode=pad`,
width: 1200,
height: 630,
},
],
},
twitter: {
export const generateMetadata = async (props: { params: Promise<Params> }) => {
const params = await props.params;

return ({
title,
card: "summary_large_image",
images: [
{
url: `https://image.mux.com/${params.playbackId}/thumbnail.png?width=1200&height=600&fit_mode=pad`,
width: 1200,
height: 600,
},
],
},
});
description: undefined,
openGraph: {
title,
images: [
{
url: `https://image.mux.com/${params.playbackId}/thumbnail.png?width=1200&height=630&fit_mode=pad`,
width: 1200,
height: 630,
},
],
},
twitter: {
title,
card: "summary_large_image",
images: [
{
url: `https://image.mux.com/${params.playbackId}/thumbnail.png?width=1200&height=600&fit_mode=pad`,
width: 1200,
height: 600,
},
],
}
});
};

const Code = ({ children }: { children: React.ReactNode }) => (
<code className="text-mono text-sm bg-red-500/10 px-1 py-0.5 rounded-sm">
Expand All @@ -44,7 +48,13 @@ const Code = ({ children }: { children: React.ReactNode }) => (
// it's perfect for the edge
export const runtime = "edge";

export default function Page({ params: { playbackId } }: { params: Params }) {
export default async function Page(props: { params: Promise<Params> }) {
const params = await props.params;

const {
playbackId
} = params;

return (
<>
<div className="px-8 py-4 mb-8 text-center bg-green-500/30 rounded-full">
Expand Down
24 changes: 19 additions & 5 deletions examples/with-mux-video/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -18,9 +22,19 @@
}
],
"paths": {
"@/*": ["./*"]
}
"@/*": [
"./*"
]
},
"target": "ES2017"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
Loading