From 2926c64a4e69cb101c6bfbdf7a53c9f9220db7c9 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Tue, 17 Apr 2018 16:16:53 +0200 Subject: [PATCH] Recording CDR events new property 'duration' --- .../src/main/java/io/openvidu/server/cdr/CDREvent.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openvidu-server/src/main/java/io/openvidu/server/cdr/CDREvent.java b/openvidu-server/src/main/java/io/openvidu/server/cdr/CDREvent.java index c3ec97be..e33e1e42 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/cdr/CDREvent.java +++ b/openvidu-server/src/main/java/io/openvidu/server/cdr/CDREvent.java @@ -63,6 +63,7 @@ public class CDREvent implements Comparable { } this.timeStamp = System.currentTimeMillis(); this.id = recording.getId(); + this.duration = (int) recording.getDuration(); this.size = recording.getSize(); this.hasAudio = recording.hasAudio(); this.hasVideo = recording.hasVideo(); @@ -118,12 +119,13 @@ public class CDREvent implements Comparable { json.put("receivingFrom", this.receivingFrom); } } - if (this.duration != null) { + if (this.startTime != null && this.duration != null) { json.put("startTime", this.startTime); json.put("endTime", this.timeStamp); json.put("duration", (this.timeStamp - this.startTime) / 1000); + } else if (this.duration != null) { + json.put("duration", duration); } - if (this.reason != null) { json.put("reason", this.reason); }