493 twitter video #531
6 changed files with 72 additions and 15 deletions
13
index.js
13
index.js
|
@ -16,7 +16,6 @@ checkForConfig('siteConfig');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const bodyParser = require('body-parser');
|
const bodyParser = require('body-parser');
|
||||||
const expressHandlebars = require('express-handlebars');
|
const expressHandlebars = require('express-handlebars');
|
||||||
const Handlebars = require('handlebars');
|
|
||||||
const helmet = require('helmet');
|
const helmet = require('helmet');
|
||||||
const cookieSession = require('cookie-session');
|
const cookieSession = require('cookie-session');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
@ -81,11 +80,15 @@ function Server () {
|
||||||
app.use(speechPassport.session());
|
app.use(speechPassport.session());
|
||||||
|
|
||||||
// configure handlebars & register it with express app
|
// configure handlebars & register it with express app
|
||||||
const hbs = expressHandlebars.create({
|
const viewsPath = Path.resolve(process.cwd(), 'node_modules/spee.ch/server/views');
|
||||||
|
app.engine('handlebars', expressHandlebars({
|
||||||
|
async: false,
|
||||||
|
dataType: 'text',
|
||||||
defaultLayout: 'embed',
|
defaultLayout: 'embed',
|
||||||
handlebars : Handlebars,
|
partialsDir: Path.join(viewsPath, '/partials'),
|
||||||
});
|
layoutsDir: Path.join(viewsPath, '/layouts')
|
||||||
app.engine('handlebars', hbs.engine);
|
}));
|
||||||
|
app.set('views', viewsPath);
|
||||||
app.set('view engine', 'handlebars');
|
app.set('view engine', 'handlebars');
|
||||||
|
|
||||||
// set the routes on the app
|
// set the routes on the app
|
||||||
hmm, I actually can't remember why I set it to hmm, I actually can't remember why I set it to `false` other than it was probably recommended in the `express-handlebars` implementation examples. I'll look into that.
|
|||||||
|
|
|
@ -3,8 +3,11 @@ const { details: { host } } = require('@config/siteConfig');
|
||||||
const sendVideoEmbedPage = ({ params }, res) => {
|
const sendVideoEmbedPage = ({ params }, res) => {
|
||||||
const claimId = params.claimId;
|
const claimId = params.claimId;
|
||||||
const name = params.name;
|
const name = params.name;
|
||||||
|
// test setting response headers
|
||||||
|
console.log('removing x-frame-options');
|
||||||
|
res.removeHeader('X-Frame-Options');
|
||||||
// get and render the content
|
// get and render the content
|
||||||
res.status(200).render('embed', { layout: 'embed', host, claimId, name });
|
res.status(200).render('embed', { host, claimId, name });
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = sendVideoEmbedPage;
|
module.exports = sendVideoEmbedPage;
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
<video width="100%" controls src="{{host}}/asset/{{name}}/{{claimId}}" type="video/mp4"></video>
|
<video controls>
|
||||||
|
<source src="{{host}}/asset/{{name}}/{{claimId}}" type="video/mp4">
|
||||||
|
Your browser does not support video
|
||||||
|
</video>
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<body id="embed-video-player">
|
<body>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
video {
|
video {
|
||||||
width:100%;
|
width:100%;
|
||||||
max-width:600px;
|
max-width:600px;
|
||||||
height:auto;
|
height:auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{{{body}}}
|
{{{ body }}}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -9,12 +9,16 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<img src="https://media.giphy.com/media/vwEHGjx71HSytx5mY8/giphy-facebook_s.jpg" alt="test embed"/>
|
<img src="https://media.giphy.com/media/vwEHGjx71HSytx5mY8/giphy-facebook_s.jpg" alt="test embed"/>
|
||||||
|
|
||||||
<p>no identifier, no ending</p>
|
<p>no identifier, no ending</p>
|
||||||
<img src="https://dev1.spee.ch/typingcat" alt="no identifier, no ending"/>
|
<img src="https://dev1.spee.ch/typingcat" alt="no identifier, no ending"/>
|
||||||
|
|
||||||
<p>no identifier, yes ending</p>
|
<p>no identifier, yes ending</p>
|
||||||
<img src="https://dev1.spee.ch/typingcat.gif" alt="no identifier, yes ending"/>
|
<img src="https://dev1.spee.ch/typingcat.gif" alt="no identifier, yes ending"/>
|
||||||
|
|
||||||
<p>yes identifier, no ending</p>
|
<p>yes identifier, no ending</p>
|
||||||
<img src="https://dev1.spee.ch/8/typingcat" alt="yes identifier, no ending"/>
|
<img src="https://dev1.spee.ch/8/typingcat" alt="yes identifier, no ending"/>
|
||||||
|
|
||||||
<p>yes identifier, yes ending</p>
|
<p>yes identifier, yes ending</p>
|
||||||
<img src="https://dev1.spee.ch/8/typingcat.gif" alt="yes identifier, yes ending"/>
|
<img src="https://dev1.spee.ch/8/typingcat.gif" alt="yes identifier, yes ending"/>
|
||||||
</body>
|
</body>
|
44
test/test-iframe.html
Normal file
44
test/test-iframe.html
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Document</title>
|
||||||
|
<style>
|
||||||
|
iframe {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>i frame: weather.gov</p>
|
||||||
|
<iframe src="http://www.weather.gov/"></iframe>
|
||||||
|
|
||||||
|
<p>i frame: dev1.spee.ch video direct embed page</p>
|
||||||
|
<iframe src="https://dev1.spee.ch/video-embed/sn123ow-1/c3cadc36688ca37c7526536cfed4448e31bacf56">
|
||||||
|
iframe not supported
|
||||||
|
</iframe>
|
||||||
|
|
||||||
|
<p>i frame: dev1.spee.ch image direct asset</p>
|
||||||
|
<iframe src="https://dev1.spee.ch/asset/donut-pla2tter/d8d93f3818f4cb8398637706fb20cc57c441261f">
|
||||||
|
iframe not supported
|
||||||
|
</iframe>
|
||||||
|
|
||||||
|
<p>i frame: image from internet</p>
|
||||||
|
<iframe src="https://c.static-nike.com/a/images/t_PDP_1280_v1/f_auto/kod3bxfy7vx99bca26cb/elite-competition-8p-basketball-721MyM.jpg">
|
||||||
|
iframe not supported
|
||||||
|
</iframe>
|
||||||
|
|
||||||
|
<p>i frame: giphy </p>
|
||||||
|
<iframe src="https://media.giphy.com/media/vwEHGjx71HSytx5mY8/giphy-facebook_s.jpg">
|
||||||
|
iframe not supported
|
||||||
|
</iframe>
|
||||||
|
|
||||||
|
<p>i frame: giphy 2</p>
|
||||||
|
<iframe src="https://media.giphy.com/media/vwEHGjx71HSytx5mY8/giphy-facebook_s">
|
||||||
|
iframe not supported
|
||||||
|
</iframe>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue
what will it take to allow async?