我试图简单地记录webrtc的视频使用我认为是一个标准的例子。图书馆在这里:https://github.com/muaz-khan/RTCMultiConnection
rtcMultiConnection.onstream = function(e) {
var mediaElement = getMediaElement(e.mediaElement, {
onRecordingStarted: function(type) {
// www.RTCMultiConnection.org/docs/startRecording/
rtcMultiConnection.streams[e.streamid].startRecording();
},
onRecordingStopped: function(type) {
// www.RTCMultiConnection.org/docs/stopRecording/
rtcMultiConnection.streams[e.streamid].stopRecording(function(blob){
console.log("test");
console.log(blob);
});
}});}我可以遵循函数调用的步骤,问题是回调永远不会从recordrtc.js.运行.
它指向https://github.com/muaz-khan/RecordRTC/blob/master/RecordRTC.js的第100行
它在那里运行:
mediaRecorder.stop(_callback);从来不回电话..。
即使直接调用函数也不起作用:
console.log(rtcMultiConnection.streams[e.streamid].audioRecorder.getBlob());
console.log(rtcMultiConnection.streams[e.streamid].videoRecorder.save("a.png"));我想知道记录are和rtcmulticonneciton的两个不同版本是否相互作用.有什么想法吗?也许是旧的记录,但我找不到旧的版本
发布于 2016-03-28 08:58:44
请使用blob.video
var stream = connection.streams['stream-id'];
stream.stopRecording(function(blob) {
var h2;
if (blob.audio) {
h2 = document.createElement('h2');
h2.innerHTML = '<a href="' + URL.createObjectURL(blob.audio) + '" target="_blank">Open recorded ' + blob.audio.type + '</a>';
div.appendChild(h2);
}
if (blob.video) {
h2 = document.createElement('h2');
h2.innerHTML = '<a href="' + URL.createObjectURL(blob.video) + '" target="_blank">Open recorded ' + blob.video.type + '</a>';
div.appendChild(h2);
}
});更新日期:2016年3月29日
以下是实际的文档:
请确保:
startRecording对于v3,可以直接使用RecordRTC:
connection.onstream = function(event) {
recordStream(event.stream);
};
function recordStream(stream) {
if (!!window.recorder) return;
window.recorder = RecordRTC(stream, {
type: 'video'
});
recorder.startRecording();
}
btnStopRecording.onclick = function() {
if (!window.recorder) return;
recorder.stopRecording(function() {
var blob = recorder.blob;
// or dataURL
recorder.getDataURL(func_callback);
});
};
btnStartRecording.onclick = function() {
var stream = connection.attachStreams[0];
recordStream(straem);
// or
var stream = connection.streamEvents['stream-id'].stream;
recordStream(straem);
};上面的代码片段也可以在v2.2.2中使用。
https://stackoverflow.com/questions/36258645
复制相似问题