diff --git a/openvidu-browser/src/OpenVidu/Session.ts b/openvidu-browser/src/OpenVidu/Session.ts index 1c69a796..073d8bc5 100644 --- a/openvidu-browser/src/OpenVidu/Session.ts +++ b/openvidu-browser/src/OpenVidu/Session.ts @@ -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)]); } /** diff --git a/openvidu-browser/src/OpenViduInternal/Events/RecordingEvent.ts b/openvidu-browser/src/OpenViduInternal/Events/RecordingEvent.ts index 1e7dfa71..83385531 100644 --- a/openvidu-browser/src/OpenViduInternal/Events/RecordingEvent.ts +++ b/openvidu-browser/src/OpenViduInternal/Events/RecordingEvent.ts @@ -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; } /** diff --git a/openvidu-browser/src/OpenViduInternal/Events/StreamEvent.ts b/openvidu-browser/src/OpenViduInternal/Events/StreamEvent.ts index c6ec48c4..d8e2ea40 100644 --- a/openvidu-browser/src/OpenViduInternal/Events/StreamEvent.ts +++ b/openvidu-browser/src/OpenViduInternal/Events/StreamEvent.ts @@ -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 */ diff --git a/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java b/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java index 3ceeb2dc..88208a56 100644 --- a/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java +++ b/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java @@ -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"; diff --git a/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java b/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java index bc4a47ec..cdd683bc 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java +++ b/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java @@ -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(),