I have videos that can be seen only if the user is authenticated. Due to which I decided to return videos in base64 format via API. However, I have quickly identified a problem, having noticed that if the file is greater than 1MB the returned data is truncated.
Example code:
$size = Storage::size($video->path);
header("Content-length: $size");
echo base64_encode(Storage::get($video->path));
<video :src="'getVideoSrc()" />
...
getVideo() {
this.axios.get('video/1').then(result => {
this.video = result.data;
});
},
getVideoSrc() {
return "data:video/mp4;base64," + this.getVideo();
}
How can this be resolved?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire