RecordRTC/RecordRTC-over-Socketio/README.md
npm install recordrtc-socketio
cd ./node_modules/recordrtc-socketio/
# to run it!
node server.js
# now open: http://localhost:9001
There are some other NPM packages regarding RecordRTC:
This experiment:
merged event; and passes-back the URL of the merged fileClient side stuff:
var socketio = io();
var files = {
audio: {
name: fileName + '.wav',
type: 'audio/wav',
dataURL: dataURL.audio
},
video: {
name: fileName + '.webm',
type: 'video/webm',
dataURL: dataURL.video
}
};
socketio.emit('message', files);
Server side code that captures above data:
io.sockets.on('connection', function(socket) {
socket.on('message', function(data) {
console.log('writing to disk');
writeToDisk(data.audio.dataURL, data.audio.name);
writeToDisk(data.video.dataURL, data.video.name);
merge(socket, data.audio.name, data.video.name);
});
});
After merging; server side code that passes back the URL of the merged file:
socket.emit('merged', audioName.split('.')[0] + '-merged.webm');
Client-side code that receives merged-file URL:
socketio.on('merged', function (fileName) {
cameraPreview.src = location.href + '/uploads/' + fileName;
cameraPreview.play();
});
merger.bat)merger.bat file is executed to invoke ffmpeg functionalities on windows:
@echo off
"C:\ffmpeg\bin\ffmpeg.exe" -i %1 -i %2 %3
It is assumed that you already have installed ffmpeg on your system. Though, EXE file is hard-coded to "C:\ffmpeg\bin\ffmpeg.exe" however you can easily edit it according to your own installations.
.sh filemerger.sh file is executed to invoke ffmpeg functionalities on Mac/Linux/etc.
ffmpeg -i video-file.webm -i audio-file.wav -map 0:0 -map 1:0 output-file-name.webm
Using Linux; ffmpeg installation is super-easy! You can install DEVEL packages as well.
http://www.wikihow.com/Install-FFmpeg-on-Windows
Make sure you have homebrew installed. Then run following command:
brew install ffmpeg --with-libvpx --with-theora --whit-libogg --with-libvorbis
In the node.js command prompt window; type node server. It will run socket.io server at port 9001. Then you can open index.html file on any webserver.
RecordRTC is released under MIT licence . Copyright (c) Muaz Khan.