Show routes #72

Merged
bones7242 merged 11 commits from show-routes into master 2017-07-07 03:10:45 +02:00
3 changed files with 8 additions and 6 deletions
Showing only changes of commit 90da7a3637 - Show all commits

View file

@ -14,7 +14,7 @@
/* show routes */
.show-image {
.show-image, .show-video {
width: 100%;
padding-top: 1em;
}

View file

@ -67,21 +67,22 @@ module.exports = (app, siofu, hostedContentPath) => {
};
// set the data
const fileExtension = filePath.substring(filePath.lastIndexOf('.'));
console.log(fileExtension);
let data = {
type : null,
buffer: assetBuffer.toString('base64'),
};
switch (fileExtension) {
case 'jpeg' || 'jpg':
case '.jpeg' || '.jpg':
data['type'] = 'image/jpeg';
break;
case 'gif':
case '.gif':
data['type'] = 'image/gif';
break;
case 'png':
case '.png':
data['type'] = 'image/png';
break;
case 'mp4':
case '.mp4':
data['type'] = 'video/mp4';
break;
default:

View file

@ -1,5 +1,6 @@
<div class="panel">
<div id="asset-placeholder" data-filepath="{{{filePath}}}">
<p> video loading... </p>
</div>
</div>
@ -23,7 +24,7 @@
break;
case 'video/mp4':
const base64video = 'data:' + data.type + ';base64,' + data.buffer;
document.getElementById("asset-placeholder").innerHTML = '<video class="show-video" src="' + base64video + '"/>';
document.getElementById("asset-placeholder").innerHTML = '<video controls class="show-video"> <source src="' + base64video + '"></video>';
break;
default: break;
}