@vikasietum_tecknology/record-rtc
Version:
record-rtc is a library based on recordrtc library. In this forked version of the original library we have optimized the memory management. The video recording is stored in IndexDB in chunks.
90 lines (69 loc) • 3.13 kB
JavaScript
describe('RecordRTC', function() {
it('audio-recording', function() {
function addLine() {
console.log('\x1b[31m%s\x1b[0m ', (new Date).toUTCString() + ':');
}
console.log('------------------------------');
console.log('\x1b[31m%s\x1b[0m ', 'audio-recording');
browser.driver.get('https://www.webrtc-experiment.com/RecordRTC/tests/audio-recording.html').then(function() {
// wait until RecordRTC ends the recording
(function looper() {
var isRecordingStopped = false;
var onStateChanged = '';
browser.driver.findElement(by.id('isRecordingStopped')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
isRecordingStopped = value.toString() === 'true';
});
browser.driver.findElement(by.id('onStateChanged')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
onStateChanged = value;
});
browser.wait(function() {
return true;
}, 1000).then(function() {
addLine();
console.log('onStateChanged: ' + onStateChanged);
if (isRecordingStopped === false) {
looper();
return;
}
onRecordingStopped();
});
})();
function onRecordingStopped() {
addLine();
console.log('onRecordingStopped');
var blobSize = 0;
var logs = '';
browser.driver.findElement(by.id('blobSize')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
blobSize = value.toString();
});
browser.driver.findElement(by.id('logs')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
logs = value.toString();
});
browser.wait(function() {
addLine();
console.log('blobSize: ' + blobSize);
addLine();
console.log(logs);
if (blobSize === 0 || blobSize === '0 Bytes' || blobSize === '0' || !blobSize || blobSize === NaN || blobSize === 'NaN' || !blobSize.toString().length) {
addLine();
console.log('\x1b[31m%s\x1b[0m ', 'audio-recording failed: ' + blobSize);
throw new Error('audio-recording failed: ' + blobSize);
}
return true;
}, 1000, 'audio-recording failed.');
}
});
});
});