Невозможно записать снова после остановки записи в Куренто

Я работаю над этим приложением Kurento, и передо мной стоит странная проблема: когда я начинаю записывать видео и останавливаю запись, я не могу снова начать другую запись. Событие отправляется на сервер, но, похоже, ничего не происходит! ПФБ код:

room.pipeline.create('WebRtcEndpoint', function (error, outgoingMedia) {        
    if (error) {
        console.error('no participant in room');
        // no participants in room yet release pipeline
        if (Object.keys(room.participants).length == 0) {
            room.pipeline.release();
        }
        return callback(error);
    }
    outgoingMedia.setMaxVideoRecvBandwidth(256);
    userSession.outgoingMedia = outgoingMedia;

    // add ice candidate the get sent before endpoint is established
    var iceCandidateQueue = userSession.iceCandidateQueue[socket.id];
    if (iceCandidateQueue) {
        while (iceCandidateQueue.length) {
            var message = iceCandidateQueue.shift();
            console.error('user : ' + userSession.id + ' collect candidate for outgoing media');
            userSession.outgoingMedia.addIceCandidate(message.candidate);
        }
    }

    userSession.outgoingMedia.on('OnIceCandidate', function (event) {
        console.log("generate outgoing candidate : " + userSession.id);
        var candidate = kurento.register.complexTypes.IceCandidate(event.candidate);
        userSession.sendMessage({
            id: 'iceCandidate',
            sessionId: userSession.id,
            candidate: candidate
        });
    });

    // notify other user that new user is joining
    var usersInRoom = room.participants;
    var data = {
        id: 'newParticipantArrived',
        new_user_id: userSession.id,
        receiveVid: receiveVid
    };

    // notify existing user
    for (var i in usersInRoom) {
        usersInRoom[i].sendMessage(data);
    }

    var existingUserIds = [];
    for (var i in room.participants) {
        existingUserIds.push({id: usersInRoom[i].id, receiveVid: usersInRoom[i].receiveVid});
    }
    // send list of current user in the room to current participant
    userSession.sendMessage({
        id: 'existingParticipants',
        data: existingUserIds,
        roomName: room.name,
        receiveVid: receiveVid
    });

    // register user to room
    room.participants[userSession.id] = userSession;

    var recorderParams = {
        mediaProfile: 'WEBM',
        uri: "file:///tmp/Room_"+room.name+"_file"+userSession.id +".webm"
    };

    //make recorder endpoint
    room.pipeline.create('RecorderEndpoint', recorderParams, function(error, recorderEndpoint){
        userSession.outgoingMedia.recorderEndpoint = recorderEndpoint;
        outgoingMedia.connect(recorderEndpoint);
    });

На экране, когда я нажимаю кнопку записи, функция на сервере:

function startRecord(socket) {
console.log("in func");
var userSession = userRegistry.getById(socket.id);

if (!userSession) {
    return;
}

var room = rooms[userSession.roomName];

if(!room){
    return;
}

var usersInRoom = room.participants;

var data = {
    id: 'startRecording'
};

for (var i in usersInRoom) {
    console.log("in loop");
    var user = usersInRoom[i];
    // release viewer from this
    user.outgoingMedia.recorderEndpoint.record();
    // notify all user in the room
    user.sendMessage(data);
    console.log(user.id);
}}

Дело в том, что в первый раз он правильно записывает, т.е. файл, созданный на сервере, и видео и аудио записываются правильно. Когда я нажимаю стоп, чтобы остановить запись, видимый эффект виден, т.е. запись останавливается.

ТЕПЕРЬ, когда я нажимаю запись снова, видео файл не сделан. Событие достигает сервера должным образом (console.log так говорит)

Может кто-нибудь помочь мне, пожалуйста!

Благодарю.

0 ответов

Другие вопросы по тегам