Show routes #72
3 changed files with 8 additions and 6 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
/* show routes */
|
/* show routes */
|
||||||
|
|
||||||
.show-image {
|
.show-image, .show-video {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-top: 1em;
|
padding-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue