我在 google 存储桶中的视频无法快进或快退
my videos on google bucket can not fast forward or rewind
所以我用 node.js 和 vue.js 构建了一个电子学习平台,我正在使用 GCP 存储桶来私密地存储我的视频,除了我的视频不能快速播放之外,一切都完美无缺前进或后退,如果你尝试将视频移动到特定位置(可能接近视频的末尾),它 returns 到你最初所在的相同位置,起初我告诉它这是一个 vue 问题,但我尝试直接从我的 GCP 存储桶仪表板播放此视频,但效果相同。它只有在我使用 firefox 浏览器时才能正常工作。
我正在使用 Uniform: No object-level ACLs enabled access control 和 Not public 权限设置。我是 GCP 的新手,我不知道可能是什么问题
这是我正在使用的node.js函数
const upload = async (req, res) => {
try {
if (!req.file) {
res.status(400).send('No file uploaded.');
return;
}
const gcsFileName = `${Date.now()}-${req.file.originalname}`;
var reader = fs.createReadStream('uploads/'+req.file.originalname);
reader.pipe(
bucket.file(gcsFileName).createWriteStream({ resumable: false, gzip: true })
.on('finish', () => {
// The public URL can be used to directly access the file via HTTP.
const publicUrl = format(
`https://storage.googleapis.com/bucketname/` + gcsFileName
);
// console.log('https://storage.googleapis.com/faslearn_files/' + gcsFileName)
fs.unlink('uploads/' + req.file.originalname, (err) => {
if (err) {
console.log("failed to delete local image:" + err);
} else {
console.log('successfully deleted local image');
}
});
res.status(200).send(publicUrl);
})
.on('error', err => {
console.log(err);
return
})
//.end(req.file.buffer)
)
// Read and display the file data on console
reader.on('data', function (chunk) {
console.log('seen chunk');
});
} catch (err) {
console.log(" some where");
res.status(500).send({
message: `Could not upload the file: ${req.file.originalname}. ${err}`,
});
}
};
问题出在我编码视频的方式上,我应该使用 blob 但我使用了管道
所以我用 node.js 和 vue.js 构建了一个电子学习平台,我正在使用 GCP 存储桶来私密地存储我的视频,除了我的视频不能快速播放之外,一切都完美无缺前进或后退,如果你尝试将视频移动到特定位置(可能接近视频的末尾),它 returns 到你最初所在的相同位置,起初我告诉它这是一个 vue 问题,但我尝试直接从我的 GCP 存储桶仪表板播放此视频,但效果相同。它只有在我使用 firefox 浏览器时才能正常工作。 我正在使用 Uniform: No object-level ACLs enabled access control 和 Not public 权限设置。我是 GCP 的新手,我不知道可能是什么问题 这是我正在使用的node.js函数
const upload = async (req, res) => {
try {
if (!req.file) {
res.status(400).send('No file uploaded.');
return;
}
const gcsFileName = `${Date.now()}-${req.file.originalname}`;
var reader = fs.createReadStream('uploads/'+req.file.originalname);
reader.pipe(
bucket.file(gcsFileName).createWriteStream({ resumable: false, gzip: true })
.on('finish', () => {
// The public URL can be used to directly access the file via HTTP.
const publicUrl = format(
`https://storage.googleapis.com/bucketname/` + gcsFileName
);
// console.log('https://storage.googleapis.com/faslearn_files/' + gcsFileName)
fs.unlink('uploads/' + req.file.originalname, (err) => {
if (err) {
console.log("failed to delete local image:" + err);
} else {
console.log('successfully deleted local image');
}
});
res.status(200).send(publicUrl);
})
.on('error', err => {
console.log(err);
return
})
//.end(req.file.buffer)
)
// Read and display the file data on console
reader.on('data', function (chunk) {
console.log('seen chunk');
});
} catch (err) {
console.log(" some where");
res.status(500).send({
message: `Could not upload the file: ${req.file.originalname}. ${err}`,
});
}
};
问题出在我编码视频的方式上,我应该使用 blob 但我使用了管道