From 369fddc68272a39f82deba0a27f385839270fd3a Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Sat, 20 May 2017 15:09:22 +0200 Subject: [PATCH] Metadata nullpointer bug fixed --- README.md | 7 ++++--- .../ts/OpenViduInternal/Connection.ts | 1 - .../server/core/api/pojo/UserParticipant.java | 18 +++++++++++++----- .../DefaultNotificationRoomHandler.java | 2 +- .../org/openvidu/server/security/Token.java | 4 ++-- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 91402a5e..9c1d1f82 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ We have implemented a very basic demo application to see OpenVidu in action. To - Run this Docker container ``` - docker run -p 8080:8080 -p 8443:8443 -e KMS_STUN_IP=193.147.51.12 -e KMS_STUN_PORT=3478 -e openvidu.security=false openvidu/openvidu-plainjs-demo + docker run -p 8443:8443 -e KMS_STUN_IP=193.147.51.12 -e KMS_STUN_PORT=3478 -e openvidu.security=false openvidu/openvidu-plainjs-demo ``` - Go to [`https://localhost:8443`](https://localhost:8443) and accept the self-signed certificate to enjoy your app. You should mute your speakers to avoid disruptive audio feedback. @@ -307,13 +307,13 @@ API reference | Event | Properties | Description | | -----------------------| --------------------- | ---------------------------- | -| `videoElementCreated` | element:HTMLVideoElement | Triggered by Publisher object inmediately after a new video element has been added to DOM | +| `videoElementCreated` | element:HTMLVideoElement | Triggered by Subscriber object inmediately after a new video element has been added to DOM | #### **Connection** | Property | Type | Description | | ------------| ------ | ---------------------------- | | `connectionId` | string | Unique identifier of the connection | -| `data` | string | Data associated to this connection (and therefore to the user). This is an important field: it allows you to broadcast all the information you want for each user (a username, for example) | +| `data` | string | Data associated to this connection (and therefore to certain user). This is an important field: it allows you to broadcast all the information you want for each user (a username, for example) | | `creationTime` | number | Time when this connection was created | ## openvidu-backend-client @@ -481,6 +481,7 @@ ng serve ``` **/openvidu** ``` +mvn compile -DskipTests=true mvn install -DskipTests=true ``` **/openvidu/openvidu-server** diff --git a/openvidu-browser/src/main/resources/ts/OpenViduInternal/Connection.ts b/openvidu-browser/src/main/resources/ts/OpenViduInternal/Connection.ts index a4d1bd0d..c5b25701 100644 --- a/openvidu-browser/src/main/resources/ts/OpenViduInternal/Connection.ts +++ b/openvidu-browser/src/main/resources/ts/OpenViduInternal/Connection.ts @@ -1,4 +1,3 @@ -// Participant -------------------------------- import { Stream, StreamOptions } from './Stream'; import { OpenViduInternal } from './OpenViduInternal'; import { SessionInternal } from './SessionInternal'; diff --git a/openvidu-server/src/main/java/org/openvidu/server/core/api/pojo/UserParticipant.java b/openvidu-server/src/main/java/org/openvidu/server/core/api/pojo/UserParticipant.java index e22482aa..abec06a8 100644 --- a/openvidu-server/src/main/java/org/openvidu/server/core/api/pojo/UserParticipant.java +++ b/openvidu-server/src/main/java/org/openvidu/server/core/api/pojo/UserParticipant.java @@ -23,18 +23,19 @@ package org.openvidu.server.core.api.pojo; * */ public class UserParticipant { + private String participantId; private String userName; - private String clientMetadata; - private String serverMetadata; + private String clientMetadata = ""; + private String serverMetadata = ""; private boolean streaming = false; + + private final String METADATA_SEPARATOR = "%/%"; public UserParticipant(String participantId, String userName, boolean streaming) { super(); this.participantId = participantId; this.userName = userName; - this.clientMetadata = ""; - this.serverMetadata = ""; this.streaming = streaming; } @@ -94,7 +95,14 @@ public class UserParticipant { } public String getFullMetadata(){ - return this.clientMetadata + "-/-" + this.serverMetadata; + String fullMetadata; + if ((!this.clientMetadata.isEmpty()) && (!this.serverMetadata.isEmpty())){ + fullMetadata = this.clientMetadata + METADATA_SEPARATOR + this.serverMetadata; + } + else { + fullMetadata = this.clientMetadata + this.serverMetadata; + } + return fullMetadata; } @Override diff --git a/openvidu-server/src/main/java/org/openvidu/server/core/internal/DefaultNotificationRoomHandler.java b/openvidu-server/src/main/java/org/openvidu/server/core/internal/DefaultNotificationRoomHandler.java index 0c0914b5..870c26e3 100644 --- a/openvidu-server/src/main/java/org/openvidu/server/core/internal/DefaultNotificationRoomHandler.java +++ b/openvidu-server/src/main/java/org/openvidu/server/core/internal/DefaultNotificationRoomHandler.java @@ -71,7 +71,7 @@ public class DefaultNotificationRoomHandler implements NotificationRoomHandler { // Metadata associated to each existing participant participantJson - .addProperty(ProtocolElements.JOINROOM_METADATA_PARAM, participant.getClientMetadata() + "--" + participant.getServerMetadata()); + .addProperty(ProtocolElements.JOINROOM_METADATA_PARAM, participant.getFullMetadata()); if (participant.isStreaming()) { JsonObject stream = new JsonObject(); diff --git a/openvidu-server/src/main/java/org/openvidu/server/security/Token.java b/openvidu-server/src/main/java/org/openvidu/server/security/Token.java index 3bbcf455..d3d34618 100644 --- a/openvidu-server/src/main/java/org/openvidu/server/security/Token.java +++ b/openvidu-server/src/main/java/org/openvidu/server/security/Token.java @@ -4,8 +4,8 @@ public class Token { String token; ParticipantRole role; - String serverMetadata; - String clientMetadata ; + String serverMetadata = ""; + String clientMetadata = ""; public Token(String token) { this.token = token;