I have an application where I present some images, videos and audios. The images works perfectly but I have problem with the audios and the videos.
Node API:
let config = new Config(),
client = config.Storage
export default class ImageCtrl {
product = (req, res, next) => {
var params = req.params,
point = params.filename.lastIndexOf('.'),
nameFile = params.filename.slice(0, point),
ext = params.filename.slice(point);
res.writeHead(200, {
'Cache-Control': 'no-cache'
});
let remote = `${nameFile}-thumb${ext}`;
if (nameFile.includes('audio')) {
remote = `${nameFile}${ext}`
}
client.download({
container: 'Multimedia',
remote: remote
}, function(err, result) {
// handle the download result
}).pipe(res);
}
}
config.ts
export default class Config {
Storage: any = pkgcloud.storage.createClient(config);
}
Angular4-HTML5
<video width="100%" *ngIf="product.mediacategory === 'video'" controls preload="none" [poster]="'/api/image/products/' + product._id + '-video.png'" controlsList="nodownload">
<source [src]="/api/image/products/5a69b1b32e4be51cb82a7659-video.webm" type="video/webm">
<source [src]="/api/image/products/5a69b1b32e4be51cb82a7659-video.mp4" type="video/mp4">
<source [src]="/api/image/products/5a69b1b32e4be51cb82a7659-video.ogv'" type="video/ogv">
</video>
For audio and image is the same API but only works in safari image. In chrome and in firefox audio, video and image works fine.
In safari it appears like this:
In chrome:
----If I remove [] of [src] it doesn't work on chrome.-----