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 routes */
.show-image { .show-image, .show-video {
width: 100%; width: 100%;
padding-top: 1em; padding-top: 1em;
} }

View file

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

View file

@ -1,5 +1,6 @@
<div class="panel"> <div class="panel">
<div id="asset-placeholder" data-filepath="{{{filePath}}}"> <div id="asset-placeholder" data-filepath="{{{filePath}}}">
<p> video loading... </p>
</div> </div>
</div> </div>
@ -23,7 +24,7 @@
break; break;
case 'video/mp4': case 'video/mp4':
const base64video = 'data:' + data.type + ';base64,' + data.buffer; 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; break;
default: break; default: break;
} }