付智勇

录制回放

... ... @@ -2,6 +2,7 @@ const router = require('koa-router')()
var userContoller = require('../controller/userController')
var status = require('../util/resTemplate')
const inspectMediaChannelKey = require('../util/inspectMediaChannelKey')
const shellUtil = require('../util/Agora_Recording_SDK_for_Linux_FULL/samples/shellUtil')
router.prefix('/users')
... ... @@ -125,4 +126,21 @@ router.post('/encryptionToken',async (ctx, next) => {
})
/**
*
*/
router.post('/Recording',async (ctx, next) => {
try{
let body = ctx.request.body;
console.log()
let Recording = await shellUtil.Recording(body.appID,body.uid,body.channel,body.channelKey)
ctx.response.status= 200;
ctx.response.body= {msg:Recording};
}catch(e){
console.log(e)
status.catchError(ctx,400,e.message);
}
})
module.exports = router
... ...
... ... @@ -5,19 +5,22 @@ function shell(){
}
shell.prototype.Recording =async(appId,uid,channel)=>{
try {
shell.prototype.Recording =async(appId,uid,channel,channelKey)=>{
return new Promise((resolve, reject) =>{
let shell =`./RECORD_APP`+
` --appId ` +appId
` --uid ` +uid
` --channel ` + channel
` --appId ` +appId +
` --uid ` +uid +
` --channel ` + channel +
` --channelKey ` + channelKey +
" --appliteDir \`pwd\`/../bin";
let backShell =callfile.exec(shell);
return backShell;
} catch (error) {
throw error
}
callfile.exec(shell,function(err, stdout, stderr){
console.log(arguments);
if(err){
reject(err);
}
resolve(arguments);
})
})
}
... ...
module.exports = ['/',"/users/addUser","/users/login",'/users/addUser?time=1','/users/encryptionToken']
\ No newline at end of file
module.exports = ['/',"/users/addUser","/users/login",'/users/addUser?time=1','/users/encryptionToken','/users/Recording']
\ No newline at end of file
... ...