Comparing version 0.0.5 to 1.0.0
@@ -11,3 +11,5 @@ // Muaz Khan - www.MuazKhan.com | ||
function home(response, postData) { | ||
response.writeHead(200, { 'Content-Type': 'text/html' }); | ||
response.writeHead(200, { | ||
'Content-Type': 'text/html' | ||
}); | ||
response.end(fs.readFileSync('./static/index.html')); | ||
@@ -34,8 +36,8 @@ } | ||
// detect the current operating system | ||
var isWin = !!process.platform.match(/^win/); | ||
var isWin = !! process.platform.match(/^win/); | ||
if (isWin) { | ||
ifWin(response, files); | ||
ifWin(response, files); | ||
} else { | ||
ifMac(response, files); | ||
ifMac(response, files); | ||
} | ||
@@ -66,3 +68,5 @@ } | ||
client = knox.createClient(config.s3), | ||
headers = { 'Content-Type': file.type }; | ||
headers = { | ||
'Content-Type': file.type | ||
}; | ||
@@ -85,3 +89,5 @@ client.putBuffer(fileBuffer, fileRootName, headers); | ||
response.writeHead(200, { 'Content-Type': extensionTypes[extension] }); | ||
response.writeHead(200, { | ||
'Content-Type': extensionTypes[extension] | ||
}); | ||
if (extensionTypes[extension] == 'video/webm') | ||
@@ -104,3 +110,3 @@ response.end(fs.readFileSync('.' + pathname)); | ||
var command = merger + ', ' + videoFile + " " + audioFile + " " + mergedFile + ''; | ||
var cmd = exec(command, function(error, stdout, stderr) { | ||
var cmd = exec(command, function (error, stdout, stderr) { | ||
if (error) { | ||
@@ -112,3 +118,5 @@ console.log(error.stack); | ||
response.statusCode = 200; | ||
response.writeHead(200, { 'Content-Type': 'application/json' }); | ||
response.writeHead(200, { | ||
'Content-Type': 'application/json' | ||
}); | ||
response.end(files.audio.name.split('.')[0] + '-merged.webm'); | ||
@@ -121,3 +129,3 @@ | ||
// auto delete file after 1-minute | ||
setTimeout(function() { | ||
setTimeout(function () { | ||
fs.unlink(mergedFile); | ||
@@ -132,39 +140,41 @@ }, 60 * 1000); | ||
var audioFile = __dirname + '/uploads/' + files.audio.name; | ||
var videoFile = __dirname + '/uploads/' + files.video.name; | ||
var mergedFile = __dirname + '/uploads/' + files.audio.name.split('.')[0] + '-merged.webm'; | ||
var util = require('util'), | ||
var videoFile = __dirname + '/uploads/' + files.video.name; | ||
var mergedFile = __dirname + '/uploads/' + files.audio.name.split('.')[0] + '-merged.webm'; | ||
var util = require('util'), | ||
exec = require('child_process').exec; | ||
//child_process = require('child_process'); | ||
//child_process = require('child_process'); | ||
var command = "ffmpeg -i " + videoFile + " -i " + audioFile + " -map 0:0 -map 1:0 " + mergedFile; | ||
var command = "ffmpeg -i " + videoFile + " -i " + audioFile + " -map 0:0 -map 1:0 " + mergedFile; | ||
var child = exec(command, function(error, stdout, stderr){ | ||
var child = exec(command, function (error, stdout, stderr) { | ||
stdout ? util.print('stdout: ' + stdout) : null; | ||
stderr ? util.print('stderr: ' + stderr) : null; | ||
stdout ? util.print('stdout: ' + stdout) : null; | ||
stderr ? util.print('stderr: ' + stderr) : null; | ||
if (error) { | ||
if (error) { | ||
console.log('exec error: ' + error); | ||
response.statusCode = 404; | ||
response.end(); | ||
console.log('exec error: ' + error); | ||
response.statusCode = 404; | ||
response.end(); | ||
} else { | ||
} else { | ||
response.statusCode = 200; | ||
response.writeHead(200, { 'Content-Type': 'application/json' }); | ||
response.end(files.audio.name.split('.')[0] + '-merged.webm'); | ||
response.statusCode = 200; | ||
response.writeHead(200, { | ||
'Content-Type': 'application/json' | ||
}); | ||
response.end(files.audio.name.split('.')[0] + '-merged.webm'); | ||
// removing audio/video files | ||
fs.unlink(audioFile); | ||
fs.unlink(videoFile); | ||
// removing audio/video files | ||
fs.unlink(audioFile); | ||
fs.unlink(videoFile); | ||
// auto delete file after 1-minute | ||
setTimeout(function() { | ||
fs.unlink(mergedFile); | ||
}, 60 * 1000); | ||
// auto delete file after 1-minute | ||
setTimeout(function () { | ||
fs.unlink(mergedFile); | ||
}, 60 * 1000); | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -171,0 +181,0 @@ |
{ | ||
"name": "recordrtc", | ||
"preferGlobal": true, | ||
"version": "0.0.5", | ||
"version": "1.0.0", | ||
"author": { | ||
@@ -48,4 +48,4 @@ "name": "Muaz Khan", | ||
"homepage": "https://github.com/muaz-khan/WebRTC-Experiment", | ||
"_id": "recordrtc@0.0.5", | ||
"_id": "recordrtc@1.0.0", | ||
"_from": "recordrtc@" | ||
} |
@@ -10,6 +10,22 @@ #### [RecordRTC to Node.js](https://github.com/muaz-khan/WebRTC-Experiment/tree/master/RecordRTC/RecordRTC-to-Nodejs) | ||
// to run! | ||
node ./node_modules/recordrtc/index.js | ||
// to run it! | ||
cd ./node_modules/recordrtc/ && node index.js | ||
``` | ||
**Make sure that directory names MUST NOT have spaces; e.g.** | ||
``` | ||
// invalid directory | ||
C:\Hello Sir\Another\RecordRTC | ||
// valid | ||
C:\Hello-Sir\Another\RecordRTC | ||
// invalid directory | ||
C:\First\Second Dir\Third\RecordRTC | ||
// valid | ||
C:\\First\Second-Dir\Third\RecordRTC | ||
``` | ||
This experiment: | ||
@@ -16,0 +32,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
93004
1280
0
450
3