Skip to content

Commit

Permalink
openvidu-browser: property "reason" added to RecordingEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Feb 21, 2019
1 parent f4905d5 commit 376cb13
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openvidu-browser/src/OpenVidu/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)]);
}

/**
Expand Down
14 changes: 13 additions & 1 deletion openvidu-browser/src/OpenViduInternal/Events/RecordingEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ public void sendRecordingStoppedNotification(Session session, Recording recordin
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(),
Expand Down

0 comments on commit 376cb13

Please sign in to comment.