Send webrtc screenshare event for recordings

This commit is contained in:
Lucas Fialho Zawacki 2018-04-25 14:36:37 +00:00
parent 1fa4b958bf
commit 8f1a128e24
6 changed files with 18 additions and 40 deletions

View File

@ -22,8 +22,7 @@ let ScreenshareRTMPBroadcastStoppedEventMessage2x =
require('./screenshare/ScreenshareRTMPBroadcastStoppedEventMessage2x.js')(Constants);
let UserCamBroadcastStoppedEventMessage2x =
require('./video/UserCamBroadcastStoppedEventMessage2x.js')(Constants);
let StartWebcamShareEvent = require('./video/StartWebcamShareEvent.js')(Constants);
let StopWebcamShareEvent = require('./video/StopWebcamShareEvent.js')(Constants);
let WebRTCShareEvent = require('./video/WebRTCShareEvent.js')(Constants);
/**
* @classdesc
@ -74,15 +73,9 @@ Messaging.prototype.generateUserCamBroadcastStoppedEventMessage2x =
return stodrbem.toJson();
}
Messaging.prototype.generateStartWebcamShareEvent =
function(meetingId, streamUrl) {
let stodrbem = new StartWebcamShareEvent(meetingId, streamUrl);
return stodrbem.payload;
}
Messaging.prototype.generateStopWebcamShareEvent =
function(meetingId, streamUrl) {
let stodrbem = new StopWebcamShareEvent(meetingId, streamUrl);
Messaging.prototype.generateWebRTCShareEvent =
function(name, meetingId, streamUrl) {
let stodrbem = new WebRTCShareEvent(name, meetingId, streamUrl);
return stodrbem.payload;
}
module.exports = new Messaging();

View File

@ -1,23 +0,0 @@
/*
*
*/
var hrTime = require('../../../utils/Utils').hrTime;
module.exports = function (C) {
function StartWebcamShareEvent (meetingId, filename) {
let date = new Date();
let timestamp = hrTime();
this.payload = {};
this.payload[C.EVENT_NAME] = C.START_WEBCAM_SHARE;
this.payload[C.MODULE] = C.MODULE_WEBCAM;
this.payload[C.MEETING_ID] = meetingId;
this.payload[C.TIMESTAMP] = timestamp;
this.payload[C.TIMESTAMP_UTC] = date.getTime() ;
this.payload[C.FILENAME] = filename;
};
return StartWebcamShareEvent;
}

View File

@ -5,13 +5,13 @@
var hrTime = require('../../../utils/Utils').hrTime;
module.exports = function (C) {
function StopWebcamShareEvent (meetingId, filename) {
function WebRTCShareEvent (name, meetingId, filename) {
let date = new Date();
let timestamp = hrTime();
this.payload = {};
this.payload[C.EVENT_NAME] = C.STOP_WEBCAM_SHARE;
this.payload[C.EVENT_NAME] = name;
this.payload[C.MODULE] = C.MODULE_WEBCAM;
this.payload[C.MEETING_ID] = meetingId;
this.payload[C.TIMESTAMP] = timestamp;
@ -19,5 +19,5 @@ module.exports = function (C) {
this.payload[C.FILENAME] = filename;
};
return StopWebcamShareEvent;
return WebRTCShareEvent;
}

View File

@ -40,6 +40,6 @@ module.exports = class RecordingSession extends MediaSession {
async process () {
const answer = await this._MediaServer.startRecording(this._mediaElement);
return Promise.resolve({ recordingId: this.id, filename: this.filename });
return Promise.resolve({ recordingId: this.id, filename: this.filename, meetingId: this.room });
}
}

View File

@ -174,6 +174,14 @@ module.exports = class Screenshare extends EventEmitter {
async startRecording() {
this.recording = await this.mcs.startRecording(this.userId, this._presenterEndpoint, this._voiceBridge);
this.sendStartShareEvent();
}
sendStartShareEvent () {
let shareEvent = Messaging.generateWebRTCShareEvent('StartWebRTCDesktopShareEvent', this.recording.meetingId, this.recording.filename);
this._BigBlueButtonGW.writeMeetingKey(this.recording.meetingId, shareEvent, function(error) {
Logger.warn('[screenshare] Error writing share event error', error);
});
}
async _startPresenter(id, sdpOffer, callback) {

View File

@ -218,13 +218,13 @@ module.exports = class Video extends EventEmitter {
};
sendStartShareEvent() {
let shareCamEvent = Messaging.generateStartWebcamShareEvent(this.meetingId, this.recording.filename);
let shareCamEvent = Messaging.generateWebRTCShareEvent('StartWebRTCShareEvent', this.meetingId, this.recording.filename);
this.bbbGW.writeMeetingKey(this.meetingId, shareCamEvent, function(error) {});
}
sendStopShareEvent () {
let stopShareEvent =
Messaging.generateStopWebcamShareEvent(this.meetingId, this.recording.filename);
Messaging.generateWebRTCShareEvent('StopWebRTCShareEvent', this.meetingId, this.recording.filename);
this.bbbGW.writeMeetingKey(this.meetingId, stopShareEvent, function(error) {});
}