openvidu-browser: property "reason" added to RecordingEvent

pull/255/head
pabloFuente 2019-02-21 14:48:26 +01:00
parent f4905d546b
commit 376cb13c48
5 changed files with 17 additions and 2 deletions

View File

@ -950,7 +950,7 @@ export class Session implements EventDispatcher {
* @hidden
*/
onRecordingStopped(response): void {
this.ee.emitEvent('recordingStopped', [new RecordingEvent(this, 'recordingStopped', response.id, response.name)]);
this.ee.emitEvent('recordingStopped', [new RecordingEvent(this, 'recordingStopped', response.id, response.name, response.reason)]);
}
/**

View File

@ -41,15 +41,27 @@ export class RecordingEvent extends Event {
*/
name?: string;
/**
* For 'recordingStopped' event:
* - "recordingStoppedByServer": the recording has been gracefully stopped by the application
* - "sessionClosedByServer": the Session has been closed by the application
* - "automaticStop": see [Automatic stop of recordings](https://openvidu.io/docs/advanced-features/recording/#automatic-stop-of-recordings)
* - "mediaServerDisconnect": OpenVidu Media Server has crashed or lost its connection. A new media server instance is active and the recording has been stopped (no media streams are available in the new media server)
*
* For 'recordingStarted' empty string
*/
reason?: string;
/**
* @hidden
*/
constructor(target: Session, type: string, id: string, name: string) {
constructor(target: Session, type: string, id: string, name: string, reason?: string) {
super(false, target, type);
this.id = id;
if (name !== id) {
this.name = name;
}
this.reason = reason;
}
/**

View File

@ -43,6 +43,7 @@ export class StreamEvent extends Event {
* - "forceDisconnectByServer": the user has been evicted from the Session by the application
* - "sessionClosedByServer": the Session has been closed by the application
* - "networkDisconnect": the user's network connection has dropped
* - "mediaServerDisconnect": OpenVidu Media Server has crashed or lost its connection. A new media server instance is active and no media streams are available in the media server
*
* For 'streamCreated' empty string
*/

View File

@ -171,6 +171,7 @@ public class ProtocolElements {
public static final String RECORDINGSTARTED_METHOD = "recordingStarted";
public static final String RECORDINGSTARTED_ID_PARAM = "id";
public static final String RECORDINGSTARTED_NAME_PARAM = "name";
public static final String RECORDINGSTOPPED_REASON_PARAM = "reason";
public static final String RECORDINGSTOPPED_METHOD = "recordingStopped";
public static final String RECORDINGSTOPPED_ID_PARAM = "id";

View File

@ -458,6 +458,7 @@ public class SessionEventsHandler {
JsonObject params = new JsonObject();
params.addProperty(ProtocolElements.RECORDINGSTOPPED_ID_PARAM, recording.getId());
params.addProperty(ProtocolElements.RECORDINGSTARTED_NAME_PARAM, recording.getName());
params.addProperty(ProtocolElements.RECORDINGSTOPPED_REASON_PARAM, reason);
for (Participant p : filteredParticipants) {
rpcNotificationService.sendNotification(p.getParticipantPrivateId(),