File: examples/save_cam_captures/node.js/play.js

Recommend this page to a friend!
  Classes of Juan Chaves   JE5   examples/save_cam_captures/node.js/play.js   Download  
File: examples/save_cam_captures/node.js/play.js
Role: Example script
Content type: text/plain
Description: Example script
Class: JE5
jQuery plugin to generate canvas, audio and video
Author: By
Last change: Change data
Add play node example save_cam_captures
Date: 2 years ago
Size: 1,623 bytes


Class file image Download
var mysql = require('mysql'); var express = require('express'); var path = require('path'); var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(express.static(path.join(__dirname, 'public'))); app.get('/play', function(req, res) { var connection = mysql.createConnection({ host : 'localhost', user : 'youruser', password : 'yourpass', database : 'youdb' }); connection.connect(); var queryString = "SELECT * FROM `streaming` WHERE ID = 1"; connection.query(queryString, function(err, dates) { if (err) { console.log(err); } else { var array_imgs = new Array(dates[0].rec.substr(1)); res.send('<!DOCTYPE html>' +'<html>' +'<head>' +'<script src=""></script>' +'<script src=""></script>' +'<title>View captures images db whith "Media capture"</title>' +'<meta charset="utf8">' +'</head>' +'<body>' +'<h1 style="font-family: Verdana; color: #fff; background-color: rgba(0, 0, 0, 0.3); padding-right: 10px; padding-left: 10px; font-size: 3.4em; margin-top: 0.5%;"> Play capture je5 save_cam_captures</h1>' +'<script>' +'$("html").je5({' +'sort:"background",' +'attrs:{' +'type:"css",' +'src:[' + array_imgs + '],' +'change:{' +'time:160,' +'rerun:100' +'}' +'}' +'})' +'</script>' +'</body>' +'</html>' ); connection.end(); } }); }); console.log('server start'); app.listen(8001);