Skip to content

Commit

Permalink
增加了onpublish和endpublish的api,监听服务端开播和关播的回调,修改数据库内容,同时修改了dockerfile,安装n…
Browse files Browse the repository at this point in the history
…ode环境
  • Loading branch information
Louis.L committed Sep 29, 2016
1 parent dfd5216 commit 8635866
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions business/LiveBusiness.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
callback(err, {});
}
if (result) {
ret = {"result": param.streamcode};
result = {"result": param.streamcode};
callback(err, result);
}
});
Expand All @@ -41,7 +41,7 @@ module.exports = {
callback(err, {});
}
if (result) {
ret = {"result": param.streamcode};
result = {"result": param.streamcode};
callback(err, result);
}
});
Expand Down
12 changes: 7 additions & 5 deletions routes/Live.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var constants = require('../services/constants');


//开播
router.post('/onpublish', function (req, res, next) {
router.get('/onpublish', function (req, res, next) {
var streamCode = req.query.name;
var param = {};
param.streamCode = streamCode;
Expand All @@ -22,17 +22,18 @@ router.post('/onpublish', function (req, res, next) {
}
if (data) {
if (data.result === "success")
res.json({result: 'success'});
res.writeHead(200, { "Content-Type": "text/html;charset=utf-8" });
res.end();
}
});
});

//停播
router.post('/endpublish', function (req, res, next) {
router.get('/endpublish', function (req, res, next) {
var streamCode = req.query.name;
var param = {};
param.streamCode = streamCode;
liveBusiness.onpublish(param, (err, data)=> {
liveBusiness.endpublish(param, (err, data)=> {
if (err) {
console.error("LiveRouter--post--end--error");
console.error(err);
Expand All @@ -41,7 +42,8 @@ router.post('/endpublish', function (req, res, next) {
}
if (data) {
if (data.result === "success")
res.json({result: 'success'});
res.writeHead(200, { "Content-Type": "text/html;charset=utf-8" });
res.end();
}
});
});
Expand Down

0 comments on commit 8635866

Please sign in to comment.