我正在使用官方node.js模块将视频上传到Vimeo,可以找到here。
我可以毫无问题地上传视频。但是,我发现上传的视频是公开的。任何人都可以访问它们。
如何将视频设为私有。我的帐户有公开和私有视频。我希望通过我的应用程序上传的视频自动变为私密。
我在API文档和我用来上传视频的上述Node.js模块的文档中找不到这一点。
答案 0 :(得分:3)
这是答案:
webpack: (config, { isServer, buildId }) => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty',
};
// XXX See https://github.com/zeit/next.js/blob/canary/examples/with-sentry-simple/next.config.js
// In `pages/_app.js`, Sentry is imported from @sentry/node. While
// @sentry/browser will run in a Node.js environment, @sentry/node will use
// Node.js-only APIs to catch even more unhandled exceptions.
//
// This works well when Next.js is SSRing your page on a server with
// Node.js, but it is not what we want when your client-side bundle is being
// executed by a browser.
//
// Luckily, Next.js will call this webpack function twice, once for the
// server and once for the client. Read more:
// https://nextjs.org/docs#customizing-webpack-config
//
// So ask Webpack to replace @sentry/node imports with @sentry/browser when
// building the browser's bundle
if (!isServer) {
config.resolve.alias['@sentry/node'] = '@sentry/browser';
}
return config;
},
var client = new Vimeo(config.client_id, config.client_secret, config.access_token)
var params = {
'name': 'Vimeo API SDK test upload',
'description': "This video was uploaded through the Vimeo API's NodeJS SDK.",
'privacy':{
'view' : "nobody"
}
}
client.upload(
filePath,
params,
function (uri) {
// Get the metadata response from the upload and log out the Vimeo.com url
client.request(uri + '?fields=link', function (error, body, statusCode, headers) {
if (error) {
console.log('There was an error making the request.')
console.log('Server reported: ' + error)
return
}
console.log('"' + filePath + '" has been uploaded to ' + body.link)
}
的其他值为:任何人|联系人|禁用|没有人密码不公开|用户*。
有关更多信息,您可以访问this page。
答案 1 :(得分:2)