-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add setup config decoupled from Next
- Loading branch information
Showing
9 changed files
with
83 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { GET } from 'next-video/request-handler'; | ||
//export { GET } from 'next-video/request-handler'; | ||
export { GET, POST } from '@/next-video'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { NextVideo } from 'next-video/process'; | ||
import { readFile } from 'fs/promises'; | ||
|
||
export const { GET, POST, handler, withNextVideo } = NextVideo({ | ||
loadAsset: async function (assetPath) { | ||
console.warn(99, assetPath); | ||
const file = await readFile(assetPath); | ||
const asset = JSON.parse(file.toString()); | ||
return asset; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { setVideoConfig } from './config.js'; | ||
import handler, { GET, POST } from './request-handler.js'; | ||
import { withNextVideo as withNextVideoInternal } from './with-next-video.js'; | ||
import type { VideoConfig } from './config.js'; | ||
import type { NextConfig } from 'next'; | ||
|
||
export function NextVideo(config?: VideoConfig) { | ||
setVideoConfig(config); | ||
|
||
const withNextVideo = (nextConfig: NextConfig) => { | ||
return withNextVideoInternal(nextConfig, config); | ||
}; | ||
|
||
return { | ||
GET, | ||
POST, | ||
handler, | ||
withNextVideo, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters