admin管理员组文章数量:1405636
import { CollectionConfig } from 'payload'
import { GetVideoUrl, VideoReward } from '@/endpoints/video.rewards'
export const Videos: CollectionConfig = { //this is video collection
slug: 'videos',
admin: {
useAsTitle: 'videoTitle',
},
upload: {
mimeTypes: ['video/mp4'],
disableLocalStorage: true,
},
endpoints: [VideoReward, GetVideoUrl], // endpoints of video collections
access: { //everything is true for now anybody can access anything
read: () => true,
create: () => true,
update: () => true,
delete: () => true,
},
fields: [
{
label: 'Video Title',
name: 'videoTitle',
type: 'text',
required: true,
},
],
}
This is the payload.config.ts
. It's not a complete file, but this is the plugin uploadthingStorage
. I can upload the videos to uploadthing; there is no issue with that.
plugins: [
payloadCloudPlugin(),
// storage-adapter-placeholder
uploadthingStorage({
collections: {
media: true,
videos: true
},
options: {
token: process.env.UPLOADTHING_TOKEN,
acl: 'public-read',
},
}),
],
When a video gets uploaded successfully it returns some data that looks like this:
{
videoTitle: 'dfgfgjthjgjtyj',
_key: 'jt4nCu8PFcktO55GPaqDj361c8YpqvBkFsldo47hxGMNaSei',
filename: 'Boat_13.mp4',
mimeType: 'video/mp4',
filesize: 30872861,
createdAt: '2025-03-21T14:12:35.834Z',
updatedAt: '2025-03-21T14:12:35.834Z',
id: '67dd73d34c65ef7d0dbfeb36',
url: 'http://localhost:3000/api/videos/file/Boat_13.mp4',
thumbnailURL: null
}
You can see the URL is on localhost:3000
. Why is that? I expected it would look like .
Is payload changing the URL which we get from uploadthing, or is there another cause?
本文标签: nextjsWhy do I get a localhost URL in response to video uploadStack Overflow
版权声明:本文标题:next.js - Why do I get a localhost URL in response to video upload? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744345035a2601706.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论