Created
May 29, 2015 23:53
-
-
Save konsumer/0ed26b48e37118d9f89d to your computer and use it in GitHub Desktop.
Simple angular youtube demo, using browserify & npm toolchain. Use npm install, npm start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.embed-responsive { | |
position: relative; | |
display: block; | |
height: 0; | |
padding: 0; | |
overflow: hidden; | |
} | |
.embed-responsive.embed-responsive-16by9 { | |
padding-bottom: 56.25%; | |
} | |
.embed-responsive-item { | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
border: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var angular = require('angular'); | |
require('angular-youtube-mb'); | |
angular.module('app', ['youtube-embed']) | |
.controller('VideodemoCtl', function($scope) { | |
$scope.theBestVideo = 'sMKoNBRZM1M'; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" ng-app="app"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="mobile-web-app-capable" content="yes"> | |
<title>Video Demo</title> | |
<link href="/app.css" rel="stylesheet" /> | |
<body> | |
<div ng-controller="VideodemoCtl"> | |
<div class="embed-responsive embed-responsive-16by9"> | |
<youtube-video class="embed-responsive-item" video-id="theBestVideo"></youtube-video> | |
</div> | |
</div> | |
</body> | |
<script src="https://cdn.polyfill.io/v1/polyfill.min.js"></script> | |
<script src="https://www.youtube.com/iframe_api"></script> | |
<script src="/app.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "viddemo", | |
"version": "1.0.0", | |
"scripts": { | |
"start": "node ./server.js" | |
}, | |
"author": "David Konsumer <konsumer@jetboystudio.com>", | |
"license": "MIT", | |
"dependencies": { | |
"angular": "^1.4.0", | |
"angular-youtube-mb": "git://github.com/konsumer/angular-youtube-embed", | |
"browserify-middleware": "^4.1.0", | |
"express": "^4.11.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'), | |
fs = require('fs'), | |
express = require('express'), | |
app = express(), | |
pubDir = __dirname, | |
browserify = require('browserify-middleware'); | |
// browserify the entry-point. this is efficiently cached if NODE_ENV=production | |
app.get('/app.js', browserify(path.join(pubDir, 'app.js'), {})); | |
// static server | |
app.use(express.static(pubDir)); | |
var port = process.env.PORT || 3000; | |
app.listen(port); | |
console.log('Listening on http://localhost:' + port); | |
module.exports = app; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment