Merge remote-tracking branch 'upstream/master'

pull/88/head
miguelrcDEV 2018-04-10 09:22:03 +02:00
commit f084eb4c73
36 changed files with 3522 additions and 8659 deletions

View File

@ -203,9 +203,9 @@ function WebRtcPeer(mode, options, callback) {
var pc = options.peerConnection var pc = options.peerConnection
var sendSource = options.sendSource || 'webcam' var sendSource = options.sendSource || 'webcam'
var dataChannelConfig = options.dataChannelConfig /*var dataChannelConfig = options.dataChannelConfig
var useDataChannels = options.dataChannels || false var useDataChannels = options.dataChannels || false
var dataChannel var dataChannel*/
var guid = uuid.v4() var guid = uuid.v4()
var configuration = recursive({ var configuration = recursive({
@ -251,11 +251,11 @@ function WebRtcPeer(mode, options, callback) {
} }
}, },
'dataChannel': { /*'dataChannel': {
get: function () { get: function () {
return dataChannel return dataChannel
} }
}, },*/
/** /**
* @member {(external:ImageData|undefined)} currentFrame * @member {(external:ImageData|undefined)} currentFrame
@ -283,7 +283,7 @@ function WebRtcPeer(mode, options, callback) {
// Init PeerConnection // Init PeerConnection
if (!pc) { if (!pc) {
pc = new RTCPeerConnection(configuration); pc = new RTCPeerConnection(configuration);
if (useDataChannels && !dataChannel) { /*if (useDataChannels && !dataChannel) {
var dcId = 'WebRtcPeer-' + self.id var dcId = 'WebRtcPeer-' + self.id
var dcOptions = undefined var dcOptions = undefined
if (dataChannelConfig) { if (dataChannelConfig) {
@ -298,7 +298,7 @@ function WebRtcPeer(mode, options, callback) {
dataChannel.onbufferedamountlow = dataChannelConfig.onbufferedamountlow; dataChannel.onbufferedamountlow = dataChannelConfig.onbufferedamountlow;
dataChannel.onerror = dataChannelConfig.onerror || noop; dataChannel.onerror = dataChannelConfig.onerror || noop;
} }
} }*/
} }
pc.addEventListener('icecandidate', function (event) { pc.addEventListener('icecandidate', function (event) {
@ -438,14 +438,14 @@ function WebRtcPeer(mode, options, callback) {
localVideo.muted = true localVideo.muted = true
} }
this.send = function (data) { /*this.send = function (data) {
if (dataChannel && dataChannel.readyState === 'open') { if (dataChannel && dataChannel.readyState === 'open') {
dataChannel.send(data) dataChannel.send(data)
} else { } else {
logger.warn( logger.warn(
'Trying to send data over a non-existing or closed data channel') 'Trying to send data over a non-existing or closed data channel')
} }
} }*/
/** /**
* Callback function invoked when a SDP answer is received. Developers are * Callback function invoked when a SDP answer is received. Developers are
@ -706,13 +706,13 @@ WebRtcPeer.prototype.dispose = function () {
logger.debug('Disposing WebRtcPeer') logger.debug('Disposing WebRtcPeer')
var pc = this.peerConnection var pc = this.peerConnection
var dc = this.dataChannel //var dc = this.dataChannel
try { try {
if (dc) { /*if (dc) {
if (dc.signalingState === 'closed') return if (dc.signalingState === 'closed') return
dc.close() dc.close()
} }*/
if (pc) { if (pc) {
if (pc.signalingState === 'closed') return if (pc.signalingState === 'closed') return

View File

@ -72,7 +72,6 @@ export class OpenVidu {
sendVideo: cameraOptions.video != null ? cameraOptions.video : true, sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
dataChannel: true,
mediaConstraints: this.openVidu.generateMediaConstraints(cameraOptions) mediaConstraints: this.openVidu.generateMediaConstraints(cameraOptions)
}; };
cameraOptions = cameraOptionsAux; cameraOptions = cameraOptionsAux;
@ -94,7 +93,6 @@ export class OpenVidu {
sendVideo: cameraOptions.video, sendVideo: cameraOptions.video,
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
dataChannel: true,
mediaConstraints: { mediaConstraints: {
video: screenConstraints.video, video: screenConstraints.video,
audio: false audio: false
@ -152,7 +150,6 @@ export class OpenVidu {
sendVideo: cameraOptions.video != null ? cameraOptions.video : true, sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
dataChannel: true,
mediaConstraints: { mediaConstraints: {
video: screenConstraints.video, video: screenConstraints.video,
audio: false audio: false
@ -179,7 +176,6 @@ export class OpenVidu {
sendVideo: true, sendVideo: true,
activeAudio: true, activeAudio: true,
activeVideo: true, activeVideo: true,
dataChannel: true,
mediaConstraints: { mediaConstraints: {
audio: true, audio: true,
video: { width: { ideal: 1280 } } video: { width: { ideal: 1280 } }

View File

@ -173,7 +173,7 @@ export class Session {
signalMessage['data'] = signal.data ? signal.data : ''; signalMessage['data'] = signal.data ? signal.data : '';
signalMessage['type'] = signal.type ? signal.type : ''; signalMessage['type'] = signal.type ? signal.type : '';
this.openVidu.openVidu.sendMessage(JSON.stringify(signalMessage)); this.openVidu.openVidu.sendMessage(JSON.stringify(signalMessage), completionHandler);
} }
} }

View File

@ -49,7 +49,6 @@ export class OpenViduInternal {
sendVideo: true, sendVideo: true,
activeAudio: true, activeAudio: true,
activeVideo: true, activeVideo: true,
dataChannel: true,
mediaConstraints: { mediaConstraints: {
audio: true, audio: true,
video: { width: { ideal: 1280 } } video: { width: { ideal: 1280 } }
@ -351,13 +350,12 @@ export class OpenViduInternal {
} }
} }
//CHAT sendMessage(message: any, completionHandler?: Function) {
sendMessage(message) {
this.sendRequest('sendMessage', { this.sendRequest('sendMessage', {
message: message message: message
}, function (error, response) { }, (error, response) => {
if (error) { if (!!completionHandler) {
console.error(error); completionHandler(!!error ? new Error(error.message) : null);
} }
}); });
}; };

View File

@ -116,24 +116,12 @@ export class SessionInternal {
} }
else { else {
if (!token) {
token = this.randomToken();
}
let joinParams = { let joinParams = {
token: token, token: (!!token) ? token : '',
session: this.sessionId, session: this.sessionId,
metadata: this.options.metadata, metadata: this.options.metadata,
secret: this.openVidu.getSecret(), secret: this.openVidu.getSecret(),
recorder: this.openVidu.getRecorder(), recorder: this.openVidu.getRecorder(),
dataChannels: false
}
if (this.localParticipant) {
if (Object.keys(this.localParticipant.getStreams()).some(streamId =>
this.remoteStreams[streamId].isDataChannelEnabled())) {
joinParams.dataChannels = true;
}
} }
this.openVidu.sendRequest('joinRoom', joinParams, (error, response) => { this.openVidu.sendRequest('joinRoom', joinParams, (error, response) => {
@ -654,8 +642,4 @@ export class SessionInternal {
} }
} }
private randomToken(): string {
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
}
} }

View File

@ -52,7 +52,6 @@ export interface InboundStreamOptions {
export interface OutboundStreamOptions { export interface OutboundStreamOptions {
activeAudio: boolean; activeAudio: boolean;
activeVideo: boolean; activeVideo: boolean;
dataChannel: boolean;
mediaConstraints: any; mediaConstraints: any;
sendAudio: boolean; sendAudio: boolean;
sendVideo: boolean; sendVideo: boolean;
@ -74,7 +73,6 @@ export class Stream {
private showMyRemote = false; private showMyRemote = false;
private localMirrored = false; private localMirrored = false;
private chanId = 0; private chanId = 0;
private dataChannelOpened = false;
inboundOptions: InboundStreamOptions; inboundOptions: InboundStreamOptions;
outboundOptions: OutboundStreamOptions; outboundOptions: OutboundStreamOptions;
@ -196,37 +194,6 @@ export class Stream {
return this.streamId + '_' + this.chanId++; return this.streamId + '_' + this.chanId++;
} }
isDataChannelEnabled() {
return this.outboundOptions.dataChannel;
}
isDataChannelOpened() {
return this.dataChannelOpened;
}
onDataChannelOpen(event) {
console.debug('Data channel is opened');
this.dataChannelOpened = true;
}
onDataChannelClosed(event) {
console.debug('Data channel is closed');
this.dataChannelOpened = false;
}
sendData(data) {
if (this.wp === undefined) {
throw new Error('WebRTC peer has not been created yet');
}
if (!this.dataChannelOpened) {
throw new Error('Data channel is not opened');
}
console.info("Sending through data channel: " + data);
this.wp.send(data);
}
getMediaStream() { getMediaStream() {
return this.mediaStream; return this.mediaStream;
} }
@ -490,15 +457,6 @@ export class Stream {
onicecandidate: this.connection.sendIceCandidate.bind(this.connection), onicecandidate: this.connection.sendIceCandidate.bind(this.connection),
} }
if (this.outboundOptions.dataChannel) {
options.dataChannelConfig = {
id: this.getChannelName(),
onopen: this.onDataChannelOpen,
onclose: this.onDataChannelClosed
};
options.dataChannels = true;
}
if (this.displayMyRemote()) { if (this.displayMyRemote()) {
this.wp = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, error => { this.wp = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, error => {
if (error) { if (error) {

View File

@ -17,7 +17,6 @@
package io.openvidu.client; package io.openvidu.client;
import static io.openvidu.client.internal.ProtocolElements.CUSTOMREQUEST_METHOD; import static io.openvidu.client.internal.ProtocolElements.CUSTOMREQUEST_METHOD;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_DATACHANNELS_PARAM;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_METHOD; import static io.openvidu.client.internal.ProtocolElements.JOINROOM_METHOD;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERID_PARAM; import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERID_PARAM;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERSTREAMID_PARAM; import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERSTREAMID_PARAM;
@ -121,14 +120,13 @@ public class OpenViduClient {
this.client.close(); this.client.close();
} }
public Map<String, List<String>> joinRoom(String roomName, String userName, Boolean dataChannels) public Map<String, List<String>> joinRoom(String roomName, String userName)
throws IOException { throws IOException {
JsonObject params = new JsonObject(); JsonObject params = new JsonObject();
params.addProperty(JOINROOM_ROOM_PARAM, roomName); params.addProperty(JOINROOM_ROOM_PARAM, roomName);
params.addProperty(JOINROOM_USER_PARAM, userName); params.addProperty(JOINROOM_USER_PARAM, userName);
if (dataChannels != null) {
params.addProperty(JOINROOM_DATACHANNELS_PARAM, dataChannels);
}
JsonElement result = client.sendRequest(JOINROOM_METHOD, params); JsonElement result = client.sendRequest(JOINROOM_METHOD, params);
Map<String, List<String>> peers = new HashMap<String, List<String>>(); Map<String, List<String>> peers = new HashMap<String, List<String>>();
JsonArray jsonPeers = JsonRoomUtils.getResponseProperty(result, "value", JsonArray.class); JsonArray jsonPeers = JsonRoomUtils.getResponseProperty(result, "value", JsonArray.class);

View File

@ -45,7 +45,7 @@ public class OpenViduException extends JsonRpcErrorException {
SIGNAL_FORMAT_INVALID_ERROR_CODE(600), SIGNAL_TO_INVALID_ERROR_CODE(601), SIGNAL_MESSAGE_INVALID_ERROR_CODE( SIGNAL_FORMAT_INVALID_ERROR_CODE(600), SIGNAL_TO_INVALID_ERROR_CODE(601), SIGNAL_MESSAGE_INVALID_ERROR_CODE(
602), 602),
RECORDING_FILE_EMPTY_ERROR(707), RECORDING_DELETE_ERROR_CODE(706), RECORDING_LIST_ERROR_CODE( RECORDING_PATH_NOT_VALID(708), RECORDING_FILE_EMPTY_ERROR(707), RECORDING_DELETE_ERROR_CODE(706), RECORDING_LIST_ERROR_CODE(
705), RECORDING_STOP_ERROR_CODE(704), RECORDING_START_ERROR_CODE( 705), RECORDING_STOP_ERROR_CODE(704), RECORDING_START_ERROR_CODE(
703), RECORDING_REPORT_ERROR_CODE(702), RECORDING_COMPLETION_ERROR_CODE(701); 703), RECORDING_REPORT_ERROR_CODE(702), RECORDING_COMPLETION_ERROR_CODE(701);
@ -73,7 +73,7 @@ public class OpenViduException extends JsonRpcErrorException {
@Override @Override
public String toString() { public String toString() {
return "CODE: " + getCodeValue() + ". EXCEPTION: " + super.toString(); return super.toString();
} }
} }

View File

@ -38,7 +38,6 @@ public class ProtocolElements {
public static final String JOINROOM_SECRET_PARAM = "secret"; public static final String JOINROOM_SECRET_PARAM = "secret";
public static final String JOINROOM_RECORDER_PARAM = "recorder"; public static final String JOINROOM_RECORDER_PARAM = "recorder";
public static final String JOINROOM_DATACHANNELS_PARAM = "dataChannels";
public static final String JOINROOM_PEERID_PARAM = "id"; public static final String JOINROOM_PEERID_PARAM = "id";
public static final String JOINROOM_PEERSTREAMS_PARAM = "streams"; public static final String JOINROOM_PEERSTREAMS_PARAM = "streams";
public static final String JOINROOM_PEERSTREAMID_PARAM = "id"; public static final String JOINROOM_PEERSTREAMID_PARAM = "id";

View File

@ -68,7 +68,7 @@ public class OpenViduClientTest {
Map<String, List<String>> joinResult = new HashMap<String, List<String>>(); Map<String, List<String>> joinResult = new HashMap<String, List<String>>();
when(jsonRpcClient.sendRequest(JOINROOM_METHOD, params)).thenReturn(result); when(jsonRpcClient.sendRequest(JOINROOM_METHOD, params)).thenReturn(result);
assertThat(client.joinRoom("room", "user", null), is(joinResult)); assertThat(client.joinRoom("room", "user"), is(joinResult));
} }
} }

View File

@ -107,13 +107,11 @@ if [[ $CURRENT_UID != $USER_ID ]]; then
DURATION=$(su myuser -c "echo '$INFO' | jq '.format.duration | tonumber'") DURATION=$(su myuser -c "echo '$INFO' | jq '.format.duration | tonumber'")
STATUS="stopped" STATUS="stopped"
# su myuser -c "echo 'TMP=${TMP}, SIZE=${SIZE}, DURATION=${DURATION}, STATUS=${STATUS}, HAS_AUDIO=${HAS_AUDIO}, HAS_VIDEO=${HAS_VIDEO}' > /recordings/.${VIDEO_NAME}.if.vars"
su myuser -c "jq -c -r \".hasAudio=${HAS_AUDIO} | .hasVideo=${HAS_VIDEO} | .duration=${DURATION} | .size=${SIZE} | .status=\\\"${STATUS}\\\"\" \"/recordings/.recording.${VIDEO_NAME}\" > ${TMP} && mv ${TMP} \"/recordings/.recording.${VIDEO_NAME}\"" su myuser -c "jq -c -r \".hasAudio=${HAS_AUDIO} | .hasVideo=${HAS_VIDEO} | .duration=${DURATION} | .size=${SIZE} | .status=\\\"${STATUS}\\\"\" \"/recordings/.recording.${VIDEO_NAME}\" > ${TMP} && mv ${TMP} \"/recordings/.recording.${VIDEO_NAME}\""
else else
TMP=$(mktemp /recordings/.${VIDEO_NAME}.XXXXXXXXXXXXXXXXXXXXXXX.if.json) TMP=$(mktemp /recordings/.${VIDEO_NAME}.XXXXXXXXXXXXXXXXXXXXXXX.else.json)
INFO=$(cat /recordings/${VIDEO_NAME}.info | jq '.') INFO=$(cat /recordings/${VIDEO_NAME}.info | jq '.')
HAS_AUDIO_AUX=$(echo "$INFO" | jq '.streams[] | select(.codec_type == "audio")') HAS_AUDIO_AUX=$(echo "$INFO" | jq '.streams[] | select(.codec_type == "audio")')
if [ -z "$HAS_AUDIO_AUX" ]; then HAS_AUDIO=false; else HAS_AUDIO=true; fi if [ -z "$HAS_AUDIO_AUX" ]; then HAS_AUDIO=false; else HAS_AUDIO=true; fi
@ -123,8 +121,6 @@ else
DURATION=$(echo "$INFO" | jq '.format.duration | tonumber') DURATION=$(echo "$INFO" | jq '.format.duration | tonumber')
STATUS="stopped" STATUS="stopped"
# echo "TMP=${TMP}, SIZE=${SIZE}, DURATION=${DURATION}, STATUS=${STATUS}, HAS_AUDIO=${HAS_AUDIO}, HAS_VIDEO=${HAS_VIDEO}" > /recordings/.${VIDEO_NAME}.if.vars
jq -c -r ".hasAudio=${HAS_AUDIO} | .hasVideo=${HAS_VIDEO} | .duration=${DURATION} | .size=${SIZE} | .status=\"${STATUS}\"" "/recordings/.recording.${VIDEO_NAME}" > ${TMP} && mv ${TMP} "/recordings/.recording.${VIDEO_NAME}" jq -c -r ".hasAudio=${HAS_AUDIO} | .hasVideo=${HAS_VIDEO} | .duration=${DURATION} | .size=${SIZE} | .status=\"${STATUS}\"" "/recordings/.recording.${VIDEO_NAME}" > ${TMP} && mv ${TMP} "/recordings/.recording.${VIDEO_NAME}"
fi fi

View File

@ -9,5 +9,5 @@ command=/bin/bash /kms.sh
redirect_stderr=true redirect_stderr=true
[program:openvidu-server] [program:openvidu-server]
command=/bin/bash -c "java -jar -Dopenvidu.publicurl=docker-local /openvidu-server-cbx.jar" command=/bin/bash -c "java -jar -Dspring.profiles.active=docker /openvidu-server.jar"
redirect_stderr=true redirect_stderr=true

View File

@ -5,6 +5,5 @@ pidfile=/var/run/supervisord.pid;
loglevel=debug loglevel=debug
[program:openvidu-server] [program:openvidu-server]
command=/bin/bash -c "java -jar -Dopenvidu.publicurl=docker-local /openvidu-server-cbx.jar" command=/bin/bash -c "java -jar -Dspring.profiles.active=docker /openvidu-server.jar"
redirect_stderr=true redirect_stderr=true

View File

@ -10,6 +10,7 @@ import { routing } from './app.routing';
import { AppMaterialModule } from 'app/app.material.module'; import { AppMaterialModule } from 'app/app.material.module';
import { InfoService } from './services/info.service'; import { InfoService } from './services/info.service';
import { RestService } from './services/rest.service';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { DashboardComponent } from './components/dashboard/dashboard.component'; import { DashboardComponent } from './components/dashboard/dashboard.component';
@ -37,7 +38,7 @@ import { LayoutBestFitComponent } from './components/layouts/layout-best-fit/lay
entryComponents: [ entryComponents: [
CredentialsDialogComponent, CredentialsDialogComponent,
], ],
providers: [InfoService], providers: [InfoService, RestService],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }

View File

@ -3,6 +3,7 @@ import { MatDialog, MatDialogRef } from '@angular/material';
import { Subscription } from 'rxjs/Subscription'; import { Subscription } from 'rxjs/Subscription';
import { InfoService } from '../../services/info.service'; import { InfoService } from '../../services/info.service';
import { RestService } from '../../services/rest.service';
import { OpenVidu, Session } from 'openvidu-browser'; import { OpenVidu, Session } from 'openvidu-browser';
import { CredentialsDialogComponent } from './credentials-dialog.component'; import { CredentialsDialogComponent } from './credentials-dialog.component';
@ -32,7 +33,9 @@ export class DashboardComponent implements OnInit, OnDestroy {
showSpinner = false; showSpinner = false;
msgChain = []; msgChain = [];
constructor(private infoService: InfoService, public dialog: MatDialog) { openviduPublicUrl: string;
constructor(private infoService: InfoService, private restService: RestService, public dialog: MatDialog) {
// Subscription to info updated event raised by InfoService // Subscription to info updated event raised by InfoService
this.infoSubscription = this.infoService.newInfo$.subscribe( this.infoSubscription = this.infoService.newInfo$.subscribe(
info => { info => {
@ -61,8 +64,15 @@ export class DashboardComponent implements OnInit, OnDestroy {
console.log('Info websocket message'); console.log('Info websocket message');
console.log(event.data); console.log(event.data);
this.infoService.updateInfo(event.data); this.infoService.updateInfo(event.data);
}; };
this.restService.getOpenViduPublicUrl()
.then(url => {
this.openviduPublicUrl = url.replace('https://', 'wss://').replace('http://', 'ws://');
})
.catch(error => {
console.error(error);
});
} }
@HostListener('window:beforeunload') @HostListener('window:beforeunload')
@ -97,8 +107,18 @@ export class DashboardComponent implements OnInit, OnDestroy {
dialogRef.afterClosed().subscribe(secret => { dialogRef.afterClosed().subscribe(secret => {
if (secret) { if (secret) {
const port = (location.port) ? location.port : '8443'; if (!this.openviduPublicUrl) {
this.connectToSession('wss://' + location.hostname + ':' + port + '/testSession?secret=' + secret); this.restService.getOpenViduPublicUrl()
.then((url => {
this.openviduPublicUrl = url.replace('https://', 'wss://').replace('http://', 'ws://');
this.connectToSession(this.openviduPublicUrl + 'testSession?secret=' + secret);
}))
.catch(error => {
console.error(error);
});
} else {
this.connectToSession(this.openviduPublicUrl + 'testSession?secret=' + secret);
}
} }
}); });
} }
@ -124,12 +144,12 @@ export class DashboardComponent implements OnInit, OnDestroy {
videoActive: true, videoActive: true,
quality: 'MEDIUM' quality: 'MEDIUM'
}, },
e => { e => {
if (!!e) { if (!!e) {
console.error(e); console.error(e);
}
} }
} );
);
publisherRemote.on('accessAllowed', () => { publisherRemote.on('accessAllowed', () => {
this.msgChain.push('Camera access allowed'); this.msgChain.push('Camera access allowed');

View File

@ -17,7 +17,7 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
secret: string; secret: string;
session: Session; session: Session;
streams = []; streams: Stream[] = [];
layout: any; layout: any;
resizeTimeout; resizeTimeout;
@ -91,7 +91,14 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
} }
private deleteRemoteStream(stream: Stream): void { private deleteRemoteStream(stream: Stream): void {
const index = this.streams.indexOf(stream, 0); let index = -1;
for (let i = 0; i < this.streams.length; i++) {
if (this.streams[i].streamId === stream.streamId) {
index = i;
break;
}
}
if (index > -1) { if (index > -1) {
this.streams.splice(index, 1); this.streams.splice(index, 1);
} }

View File

@ -0,0 +1,34 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class RestService {
private openviduPublicUrl: string;
getOpenViduPublicUrl(): Promise<string> {
return new Promise((resolve, reject) => {
if (!!this.openviduPublicUrl) {
resolve(this.openviduPublicUrl);
} else {
const url = location.protocol + '//' + location.hostname + ((!!location.port) ? (':' + location.port) : '') +
'/config/openvidu-publicurl';
const http = new XMLHttpRequest();
http.onreadystatechange = () => {
if (http.readyState === 4) {
if (http.status === 200) {
this.openviduPublicUrl = http.responseText;
resolve(http.responseText);
} else {
reject('Error getting OpenVidu publicurl');
}
};
}
http.open('GET', url, true);
http.send();
}
});
}
}

View File

@ -16,9 +16,11 @@
package io.openvidu.server; package io.openvidu.server;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
import javax.annotation.PostConstruct;
import javax.ws.rs.ProcessingException; import javax.ws.rs.ProcessingException;
import org.kurento.jsonrpc.JsonUtils; import org.kurento.jsonrpc.JsonUtils;
@ -31,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
@ -126,14 +127,36 @@ public class OpenViduServer implements JsonRpcConfigurer {
return new CallDetailRecord(); return new CallDetailRecord();
} }
@Bean
@ConditionalOnMissingBean
public OpenviduConfig openviduConfig() {
return new OpenviduConfig();
}
@Bean
@ConditionalOnMissingBean
public ComposedRecordingService composedRecordingService() {
return new ComposedRecordingService();
}
@Override @Override
public void registerJsonRpcHandlers(JsonRpcHandlerRegistry registry) { public void registerJsonRpcHandlers(JsonRpcHandlerRegistry registry) {
registry.addHandler(rpcHandler().withPingWatchdog(true), "/room"); registry.addHandler(rpcHandler().withPingWatchdog(true), "/room");
} }
private static String getContainerIp() throws IOException, InterruptedException {
return CommandExecutor.execCommand("/bin/sh", "-c", "hostname -i | awk '{print $1}'");
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = start(args); log.info("Using /dev/urandom for secure random generation");
OpenviduConfig openviduConf = context.getBean(OpenviduConfig.class); System.setProperty("java.security.egd", "file:/dev/./urandom");
SpringApplication.run(OpenViduServer.class, args);
}
@PostConstruct
public void init() throws MalformedURLException, InterruptedException {
OpenviduConfig openviduConf = openviduConfig();
String publicUrl = openviduConf.getOpenViduPublicUrl(); String publicUrl = openviduConf.getOpenViduPublicUrl();
String type = publicUrl; String type = publicUrl;
@ -142,20 +165,25 @@ public class OpenViduServer implements JsonRpcConfigurer {
case "ngrok": case "ngrok":
try { try {
NgrokRestController ngrok = new NgrokRestController(); NgrokRestController ngrok = new NgrokRestController();
String ngrokAppUrl = ngrok.getNgrokAppUrl();
if (ngrokAppUrl.isEmpty()) {
ngrokAppUrl = "(No tunnel 'app' found in ngrok.yml)";
}
final String NEW_LINE = System.getProperty("line.separator"); final String NEW_LINE = System.getProperty("line.separator");
String str = NEW_LINE + " PUBLIC IP " + String str = NEW_LINE +
NEW_LINE + " APP PUBLIC IP " +
NEW_LINE + "-------------------------" + NEW_LINE + "-------------------------" +
NEW_LINE + ngrok.getNgrokAppUrl() + NEW_LINE + ngrokAppUrl +
NEW_LINE + "-------------------------" + NEW_LINE + "-------------------------" +
NEW_LINE; NEW_LINE;
System.out.println(str); log.info(str);
OpenViduServer.publicUrl = ngrok.getNgrokServerUrl().replaceFirst("https://", "wss://"); OpenViduServer.publicUrl = ngrok.getNgrokServerUrl().replaceFirst("https://", "wss://");
openviduConf.setFinalUrl(ngrok.getNgrokServerUrl()); openviduConf.setFinalUrl(ngrok.getNgrokServerUrl());
} catch (Exception e) { } catch (Exception e) {
System.err.println("Ngrok URL was configured, but there was an error connecting to ngrok: " log.error("Ngrok URL was configured, but there was an error connecting to ngrok: "
+ e.getClass().getName() + " " + e.getMessage()); + e.getClass().getName() + " " + e.getMessage());
System.err.println("Fallback to local URL"); log.error("Fallback to local URL");
} }
break; break;
@ -164,18 +192,15 @@ public class OpenViduServer implements JsonRpcConfigurer {
OpenViduServer.publicUrl = "wss://" + getContainerIp() + ":" + openviduConf.getServerPort(); OpenViduServer.publicUrl = "wss://" + getContainerIp() + ":" + openviduConf.getServerPort();
openviduConf.setFinalUrl("https://" + getContainerIp() + ":" + openviduConf.getServerPort()); openviduConf.setFinalUrl("https://" + getContainerIp() + ":" + openviduConf.getServerPort());
} catch (Exception e) { } catch (Exception e) {
System.err.println("Docker container IP was configured, but there was an error obtaining IP: " log.error("Docker container IP was configured, but there was an error obtaining IP: "
+ e.getClass().getName() + " " + e.getMessage()); + e.getClass().getName() + " " + e.getMessage());
System.err.println("Fallback to local URL"); log.error("Fallback to local URL");
} }
break; break;
case "local": case "local":
break; break;
case "docker-local":
break;
default: default:
URL url = new URL(publicUrl); URL url = new URL(publicUrl);
@ -213,9 +238,9 @@ public class OpenViduServer implements JsonRpcConfigurer {
boolean recordingModuleEnabled = openviduConf.isRecordingModuleEnabled(); boolean recordingModuleEnabled = openviduConf.isRecordingModuleEnabled();
if (recordingModuleEnabled) { if (recordingModuleEnabled) {
ComposedRecordingService recordingService = context.getBean(ComposedRecordingService.class); ComposedRecordingService recordingService = composedRecordingService();
recordingService.setRecordingVersion(openviduConf.getOpenViduRecordingVersion()); recordingService.setRecordingVersion(openviduConf.getOpenViduRecordingVersion());
System.out.println("Recording module required: Downloading openvidu/openvidu-recording:" log.info("Recording module required: Downloading openvidu/openvidu-recording:"
+ openviduConf.getOpenViduRecordingVersion() + " Docker image (800 MB aprox)"); + openviduConf.getOpenViduRecordingVersion() + " Docker image (800 MB aprox)");
boolean imageExists = false; boolean imageExists = false;
@ -223,28 +248,34 @@ public class OpenViduServer implements JsonRpcConfigurer {
imageExists = recordingService.recordingImageExistsLocally(); imageExists = recordingService.recordingImageExistsLocally();
} catch (ProcessingException exception) { } catch (ProcessingException exception) {
String message = "Exception connecting to Docker daemon: "; String message = "Exception connecting to Docker daemon: ";
if ("docker-local".equals(openviduConf.getOpenViduPublicUrl())) { if ("docker".equals(openviduConf.getSpringProfile())) {
message += "make sure you include flag \"-v /var/run/docker.sock:/var/run/docker.sock\" in \"docker run\" command"; final String NEW_LINE = System.getProperty("line.separator");
message += "make sure you include the following flags in your \"docker run\" command:" +
NEW_LINE + " -e openvidu.recording.path=/YOUR/PATH/TO/VIDEO/FILES" +
NEW_LINE + " -e MY_UID=$(id -u $USER)" +
NEW_LINE + " -v /var/run/docker.sock:/var/run/docker.sock" +
NEW_LINE + " -v /YOUR/PATH/TO/VIDEO/FILES:/YOUR/PATH/TO/VIDEO/FILES" +
NEW_LINE;
} else { } else {
message += "you need Docker installed in this machine to enable OpenVidu recorder service"; message += "you need Docker installed in this machine to enable OpenVidu recording service";
} }
log.error(message); log.error(message);
throw new RuntimeException(message); throw new RuntimeException(message);
} }
if (imageExists) { if (imageExists) {
System.out.println("Docker image already exists locally"); log.info("Docker image already exists locally");
} else { } else {
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
boolean keep = true; boolean keep = true;
System.out.print("Downloading "); log.info("Downloading ");
while (keep) { while (keep) {
System.out.print("."); System.out.print(".");
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
keep = false; keep = false;
System.out.println("\nDownload complete"); log.info("\nDownload complete");
} }
} }
}); });
@ -252,21 +283,12 @@ public class OpenViduServer implements JsonRpcConfigurer {
recordingService.downloadRecordingImage(); recordingService.downloadRecordingImage();
t.interrupt(); t.interrupt();
t.join(); t.join();
System.out.println("Docker image available"); log.info("Docker image available");
} }
recordingService.initRecordingPath();
} }
log.info("OpenVidu Server using " + type + " URL: [" + OpenViduServer.publicUrl + "]");
System.out.println("OpenVidu Server using " + type + " URL: [" + OpenViduServer.publicUrl + "]");
}
private static String getContainerIp() throws IOException, InterruptedException {
return CommandExecutor.execCommand("/bin/sh", "-c", "hostname -i | awk '{print $1}'");
}
public static ConfigurableApplicationContext start(String[] args) {
log.info("Using /dev/urandom for secure random generation");
System.setProperty("java.security.egd", "file:/dev/./urandom");
return SpringApplication.run(OpenViduServer.class, args);
} }
} }

View File

@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
public class OpenviduConfig { public class OpenviduConfig {
@Value("${openvidu.publicurl}") @Value("${openvidu.publicurl}")
private String openviduPublicUrl; // local, docker-local, ngrok, docker, [FINAL_URL] private String openviduPublicUrl; // local, ngrok, docker, [FINAL_URL]
@Value("${server.port}") @Value("${server.port}")
private String serverPort; private String serverPort;
@ -30,6 +30,9 @@ public class OpenviduConfig {
@Value("${openvidu.recording.version}") @Value("${openvidu.recording.version}")
String openviduRecordingVersion; String openviduRecordingVersion;
@Value("#{'${spring.profiles.active:}'.length() > 0 ? '${spring.profiles.active:}'.split(',') : \"default\"}")
private String springProfile;
private String finalUrl; private String finalUrl;
public String getOpenViduPublicUrl() { public String getOpenViduPublicUrl() {
@ -80,4 +83,8 @@ public class OpenviduConfig {
return this.openviduRecordingVersion; return this.openviduRecordingVersion;
} }
public String getSpringProfile() {
return springProfile;
}
} }

View File

@ -26,6 +26,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET, "/api/recordings").authenticated() .antMatchers(HttpMethod.GET, "/api/recordings").authenticated()
.antMatchers(HttpMethod.GET, "/api/recordings/**").authenticated() .antMatchers(HttpMethod.GET, "/api/recordings/**").authenticated()
.antMatchers(HttpMethod.DELETE, "/api/recordings/**").authenticated() .antMatchers(HttpMethod.DELETE, "/api/recordings/**").authenticated()
.antMatchers(HttpMethod.GET, "/config/**").authenticated()
.antMatchers("/").authenticated(); .antMatchers("/").authenticated();
if (openviduConf.getOpenViduRecordingFreeAccess()) { if (openviduConf.getOpenViduRecordingFreeAccess()) {

View File

@ -149,7 +149,7 @@ public abstract class SessionManager {
public String newSessionId(SessionProperties sessionProperties) { public String newSessionId(SessionProperties sessionProperties) {
String sessionId = OpenViduServer.publicUrl; String sessionId = OpenViduServer.publicUrl;
sessionId += "/" + RandomStringUtils.randomAlphanumeric(16).toLowerCase(); sessionId += "/" + this.generateRandomChain();
this.sessionidTokenTokenobj.put(sessionId, new ConcurrentHashMap<>()); this.sessionidTokenTokenobj.put(sessionId, new ConcurrentHashMap<>());
this.sessionidParticipantpublicidParticipant.put(sessionId, new ConcurrentHashMap<>()); this.sessionidParticipantpublicidParticipant.put(sessionId, new ConcurrentHashMap<>());
@ -159,17 +159,17 @@ public abstract class SessionManager {
return sessionId; return sessionId;
} }
public String newToken(String sessionId, ParticipantRole role, String serverMetadata) { public String newToken(String sessionId, ParticipantRole role, String serverMetadata) throws OpenViduException {
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null
&& this.sessionidTokenTokenobj.get(sessionId) != null) { && this.sessionidTokenTokenobj.get(sessionId) != null) {
if (isMetadataFormatCorrect(serverMetadata)) { if (isMetadataFormatCorrect(serverMetadata)) {
String token = RandomStringUtils.randomAlphanumeric(16).toLowerCase(); String token = this.generateRandomChain();
this.sessionidTokenTokenobj.get(sessionId).put(token, new Token(token, role, serverMetadata)); this.sessionidTokenTokenobj.get(sessionId).put(token, new Token(token, role, serverMetadata));
showTokens(); showTokens();
return token; return token;
} else { } else {
throw new OpenViduException(Code.GENERIC_ERROR_CODE, throw new OpenViduException(Code.GENERIC_ERROR_CODE,
"Data invalid format. Max length allowed is 1000 chars"); "Data invalid format. Max length allowed is 10000 chars");
} }
} else { } else {
System.out.println("Error: the sessionId [" + sessionId + "] is not valid"); System.out.println("Error: the sessionId [" + sessionId + "] is not valid");
@ -223,8 +223,8 @@ public abstract class SessionManager {
} }
public boolean isMetadataFormatCorrect(String metadata) { public boolean isMetadataFormatCorrect(String metadata) {
// Max 1000 chars // Max 10000 chars
return (metadata.length() <= 1000); return (metadata.length() <= 10000);
} }
public void newInsecureParticipant(String participantPrivateId) { public void newInsecureParticipant(String participantPrivateId) {
@ -234,12 +234,12 @@ public abstract class SessionManager {
public Participant newParticipant(String sessionId, String participantPrivatetId, Token token, public Participant newParticipant(String sessionId, String participantPrivatetId, Token token,
String clientMetadata) { String clientMetadata) {
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) { if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
String participantPublicId = RandomStringUtils.randomAlphanumeric(16).toLowerCase(); String participantPublicId = this.generateRandomChain();
ConcurrentHashMap<String, Participant> participantpublicidParticipant = this.sessionidParticipantpublicidParticipant ConcurrentHashMap<String, Participant> participantpublicidParticipant = this.sessionidParticipantpublicidParticipant
.get(sessionId); .get(sessionId);
while (participantpublicidParticipant.containsKey(participantPublicId)) { while (participantpublicidParticipant.containsKey(participantPublicId)) {
// Avoid random 'participantpublicid' collisions // Avoid random 'participantpublicid' collisions
participantPublicId = RandomStringUtils.randomAlphanumeric(16).toLowerCase(); participantPublicId = this.generateRandomChain();
} }
Participant p = new Participant(participantPrivatetId, participantPublicId, token, clientMetadata); Participant p = new Participant(participantPrivatetId, participantPublicId, token, clientMetadata);
this.sessionidParticipantpublicidParticipant.get(sessionId).put(participantPublicId, p); this.sessionidParticipantpublicidParticipant.get(sessionId).put(participantPublicId, p);
@ -267,9 +267,6 @@ public abstract class SessionManager {
if (t != null) { if (t != null) {
return t; return t;
} else { } else {
if (isInsecureParticipant(participantPrivateId)) {
return null;
}
throw new OpenViduException(Code.TOKEN_CANNOT_BE_CREATED_ERROR_CODE, sessionId); throw new OpenViduException(Code.TOKEN_CANNOT_BE_CREATED_ERROR_CODE, sessionId);
} }
} else { } else {
@ -289,6 +286,10 @@ public abstract class SessionManager {
log.info("<SESSIONID, PARTICIPANTS>: {}", this.sessionidParticipantpublicidParticipant.toString()); log.info("<SESSIONID, PARTICIPANTS>: {}", this.sessionidParticipantpublicidParticipant.toString());
} }
public String generateRandomChain() {
return RandomStringUtils.randomAlphanumeric(16).toLowerCase();
}
/** /**
* Closes all resources. This method has been annotated with the @PreDestroy * Closes all resources. This method has been annotated with the @PreDestroy
* directive (javax.annotation package) so that it will be automatically called * directive (javax.annotation package) so that it will be automatically called

View File

@ -35,7 +35,6 @@ public class KurentoParticipant extends Participant {
private InfoHandler infoHandler; private InfoHandler infoHandler;
private boolean dataChannels = false;
private boolean webParticipant = true; private boolean webParticipant = true;
private final KurentoSession session; private final KurentoSession session;
@ -52,7 +51,7 @@ public class KurentoParticipant extends Participant {
participant.getClientMetadata()); participant.getClientMetadata());
this.session = kurentoSession; this.session = kurentoSession;
this.pipeline = pipeline; this.pipeline = pipeline;
this.publisher = new PublisherEndpoint(webParticipant, dataChannels, this, participant.getParticipantPublicId(), this.publisher = new PublisherEndpoint(webParticipant, this, participant.getParticipantPublicId(),
pipeline); pipeline);
for (Participant other : session.getParticipants()) { for (Participant other : session.getParticipants()) {
@ -199,7 +198,7 @@ public class KurentoParticipant extends Participant {
log.info("PARTICIPANT {}: unpublishing media stream from room {}", this.getParticipantPublicId(), log.info("PARTICIPANT {}: unpublishing media stream from room {}", this.getParticipantPublicId(),
this.session.getSessionId()); this.session.getSessionId());
releasePublisherEndpoint(); releasePublisherEndpoint();
this.publisher = new PublisherEndpoint(webParticipant, dataChannels, this, this.getParticipantPublicId(), this.publisher = new PublisherEndpoint(webParticipant, this, this.getParticipantPublicId(),
pipeline); pipeline);
log.info( log.info(
"PARTICIPANT {}: released publisher endpoint and left it initialized (ready for future streaming)", "PARTICIPANT {}: released publisher endpoint and left it initialized (ready for future streaming)",

View File

@ -53,7 +53,6 @@ public abstract class MediaEndpoint {
private static Logger log; private static Logger log;
private boolean web = false; private boolean web = false;
private boolean dataChannels = false;
private WebRtcEndpoint webEndpoint = null; private WebRtcEndpoint webEndpoint = null;
private RtpEndpoint endpoint = null; private RtpEndpoint endpoint = null;
@ -75,13 +74,12 @@ public abstract class MediaEndpoint {
* Constructor to set the owner, the endpoint's name and the media pipeline. * Constructor to set the owner, the endpoint's name and the media pipeline.
* *
* @param web * @param web
* @param dataChannels
* @param owner * @param owner
* @param endpointName * @param endpointName
* @param pipeline * @param pipeline
* @param log * @param log
*/ */
public MediaEndpoint(boolean web, boolean dataChannels, KurentoParticipant owner, String endpointName, public MediaEndpoint(boolean web, KurentoParticipant owner, String endpointName,
MediaPipeline pipeline, Logger log) { MediaPipeline pipeline, Logger log) {
if (log == null) { if (log == null) {
MediaEndpoint.log = LoggerFactory.getLogger(MediaEndpoint.class); MediaEndpoint.log = LoggerFactory.getLogger(MediaEndpoint.class);
@ -89,7 +87,6 @@ public abstract class MediaEndpoint {
MediaEndpoint.log = log; MediaEndpoint.log = log;
} }
this.web = web; this.web = web;
this.dataChannels = dataChannels;
this.owner = owner; this.owner = owner;
this.setEndpointName(endpointName); this.setEndpointName(endpointName);
this.setMediaPipeline(pipeline); this.setMediaPipeline(pipeline);
@ -244,9 +241,9 @@ public abstract class MediaEndpoint {
protected void internalEndpointInitialization(final CountDownLatch endpointLatch) { protected void internalEndpointInitialization(final CountDownLatch endpointLatch) {
if (this.isWeb()) { if (this.isWeb()) {
WebRtcEndpoint.Builder builder = new WebRtcEndpoint.Builder(pipeline); WebRtcEndpoint.Builder builder = new WebRtcEndpoint.Builder(pipeline);
if (this.dataChannels) { /*if (this.dataChannels) {
builder.useDataChannels(); builder.useDataChannels();
} }*/
builder.buildAsync(new Continuation<WebRtcEndpoint>() { builder.buildAsync(new Continuation<WebRtcEndpoint>() {
@Override @Override
public void onSuccess(WebRtcEndpoint result) throws Exception { public void onSuccess(WebRtcEndpoint result) throws Exception {

View File

@ -55,9 +55,9 @@ public class PublisherEndpoint extends MediaEndpoint {
private Map<String, ListenerSubscription> elementsErrorSubscriptions = private Map<String, ListenerSubscription> elementsErrorSubscriptions =
new HashMap<String, ListenerSubscription>(); new HashMap<String, ListenerSubscription>();
public PublisherEndpoint(boolean web, boolean dataChannels, KurentoParticipant owner, public PublisherEndpoint(boolean web, KurentoParticipant owner,
String endpointName, MediaPipeline pipeline) { String endpointName, MediaPipeline pipeline) {
super(web, dataChannels, owner, endpointName, pipeline, log); super(web, owner, endpointName, pipeline, log);
} }
@Override @Override

View File

@ -39,7 +39,7 @@ public class SubscriberEndpoint extends MediaEndpoint {
public SubscriberEndpoint(boolean web, KurentoParticipant owner, String endpointName, public SubscriberEndpoint(boolean web, KurentoParticipant owner, String endpointName,
MediaPipeline pipeline) { MediaPipeline pipeline) {
super(web, false, owner, endpointName, pipeline, log); super(web, owner, endpointName, pipeline, log);
} }
public synchronized String subscribe(String sdpOffer, PublisherEndpoint publisher) { public synchronized String subscribe(String sdpOffer, PublisherEndpoint publisher) {

View File

@ -3,6 +3,9 @@ package io.openvidu.server.recording;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
@ -52,7 +55,7 @@ import io.openvidu.server.core.Session;
@Service @Service
public class ComposedRecordingService { public class ComposedRecordingService {
private Logger log = LoggerFactory.getLogger(ComposedRecordingService.class); private static final Logger log = LoggerFactory.getLogger(ComposedRecordingService.class);
@Autowired @Autowired
OpenviduConfig openviduConfig; OpenviduConfig openviduConfig;
@ -213,7 +216,8 @@ public class ComposedRecordingService {
throw e; throw e;
} }
} catch (DockerClientException e) { } catch (DockerClientException e) {
log.info("Error on Pulling '{}' image. Probably because the user has stopped the execution", IMAGE_NAME + ":" + IMAGE_TAG); log.info("Error on Pulling '{}' image. Probably because the user has stopped the execution",
IMAGE_NAME + ":" + IMAGE_TAG);
throw e; throw e;
} }
} }
@ -232,8 +236,8 @@ public class ComposedRecordingService {
private String runRecordingContainer(List<String> envs, String containerName) { private String runRecordingContainer(List<String> envs, String containerName) {
Volume volume1 = new Volume("/recordings"); Volume volume1 = new Volume("/recordings");
CreateContainerCmd cmd = dockerClient.createContainerCmd(IMAGE_NAME + ":" + IMAGE_TAG).withName(containerName).withEnv(envs) CreateContainerCmd cmd = dockerClient.createContainerCmd(IMAGE_NAME + ":" + IMAGE_TAG).withName(containerName)
.withNetworkMode("host").withVolumes(volume1) .withEnv(envs).withNetworkMode("host").withVolumes(volume1)
.withBinds(new Bind(openviduConfig.getOpenViduRecordingPath(), volume1)); .withBinds(new Bind(openviduConfig.getOpenViduRecordingPath(), volume1));
CreateContainerResponse container = null; CreateContainerResponse container = null;
try { try {
@ -289,9 +293,33 @@ public class ComposedRecordingService {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
public File initRecordingPath() throws OpenViduException {
try {
Path path = Files.createDirectories(Paths.get(this.openviduConfig.getOpenViduRecordingPath()));
if (!Files.isWritable(path)) {
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID,
"The recording path '" + this.openviduConfig.getOpenViduRecordingPath()
+ "' is not valid. Reason: OpenVidu Server process needs write permissions");
}
log.info("Recording path: {}", this.openviduConfig.getOpenViduRecordingPath());
return path.toFile();
} catch (IOException e) {
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID,
"The recording path '" + this.openviduConfig.getOpenViduRecordingPath() + "' is not valid. Reason: "
+ e.getClass().getName());
}
}
private Set<String> getRecordingIdsFromHost() { private Set<String> getRecordingIdsFromHost() {
File folder = new File(this.openviduConfig.getOpenViduRecordingPath()); File folder = new File(this.openviduConfig.getOpenViduRecordingPath());
File[] files = folder.listFiles(); File[] files = folder.listFiles();
if (files == null) {
files = initRecordingPath().listFiles();
}
Set<String> fileNamesNoExtension = new HashSet<>(); Set<String> fileNamesNoExtension = new HashSet<>();
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
if (files[i].isFile() && !files[i].getName().startsWith(RECORDING_ENTITY_FILE)) { if (files[i].isFile() && !files[i].getName().startsWith(RECORDING_ENTITY_FILE)) {
@ -304,6 +332,11 @@ public class ComposedRecordingService {
private Set<Recording> getRecordingEntitiesFromHost() { private Set<Recording> getRecordingEntitiesFromHost() {
File folder = new File(this.openviduConfig.getOpenViduRecordingPath()); File folder = new File(this.openviduConfig.getOpenViduRecordingPath());
File[] files = folder.listFiles(); File[] files = folder.listFiles();
if (files == null) {
files = initRecordingPath().listFiles();
}
Set<Recording> recordingEntities = new HashSet<>(); Set<Recording> recordingEntities = new HashSet<>();
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
Recording recording = this.getRecordingFromFile(files[i]); Recording recording = this.getRecordingFromFile(files[i]);

View File

@ -0,0 +1,38 @@
package io.openvidu.server.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.openvidu.server.config.OpenviduConfig;
/**
*
* @author Pablo Fuente Pérez
*/
@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/config")
public class ConfigRestController {
@Autowired
OpenviduConfig openviduConfig;
@RequestMapping(value = "/openvidu-publicurl", method = RequestMethod.GET)
public String getOpenViduPublicUrl() {
return openviduConfig.getFinalUrl();
}
@RequestMapping(value = "/openvidu-recording", method = RequestMethod.GET)
public Boolean getOpenViduRecordingEnabled() {
return openviduConfig.isRecordingModuleEnabled();
}
@RequestMapping(value = "/openvidu-recording-path", method = RequestMethod.GET)
public String getOpenViduRecordingPath() {
return openviduConfig.getOpenViduRecordingPath();
}
}

View File

@ -140,7 +140,7 @@ public class SessionRestController {
HttpStatus.BAD_REQUEST); HttpStatus.BAD_REQUEST);
} catch (OpenViduException e) { } catch (OpenViduException e) {
return this.generateErrorResponse( return this.generateErrorResponse(
"Metadata [" + params.get("data") + "] unexpected format. Max length allowed is 1000 chars", "Metadata [" + params.get("data") + "] unexpected format. Max length allowed is 10000 chars",
"/api/tokens", HttpStatus.BAD_REQUEST); "/api/tokens", HttpStatus.BAD_REQUEST);
} }
} }

View File

@ -21,6 +21,7 @@ import io.openvidu.client.internal.ProtocolElements;
import io.openvidu.server.config.OpenviduConfig; import io.openvidu.server.config.OpenviduConfig;
import io.openvidu.server.core.MediaOptions; import io.openvidu.server.core.MediaOptions;
import io.openvidu.server.core.Participant; import io.openvidu.server.core.Participant;
import io.openvidu.server.core.ParticipantRole;
import io.openvidu.server.core.SessionManager; import io.openvidu.server.core.SessionManager;
import io.openvidu.server.core.Token; import io.openvidu.server.core.Token;
@ -52,7 +53,30 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
log.debug("WebSocket session #{} - Request: {}", participantPrivateId, request); log.debug("WebSocket session #{} - Request: {}", participantPrivateId, request);
RpcConnection rpcConnection = notificationService.addTransaction(transaction, request); RpcConnection rpcConnection;
if (ProtocolElements.JOINROOM_METHOD.equals(request.getMethod())) {
// Store new RpcConnection information if method 'joinRoom'
rpcConnection = notificationService.newRpcConnection(transaction, request);
} else if (notificationService.getRpcConnection(participantPrivateId) == null) {
// Throw exception if any method is called before 'joinRoom'
log.warn(
"No connection found for participant with privateId {} when trying to execute method '{}'. Method 'Session.connect()' must be the first operation called in any session",
participantPrivateId, request.getMethod());
throw new OpenViduException(Code.TRANSPORT_ERROR_CODE,
"No connection found for participant with privateId " + participantPrivateId
+ ". Method 'Session.connect()' must be the first operation called in any session");
}
rpcConnection = notificationService.addTransaction(transaction, request);
String sessionId = rpcConnection.getSessionId();
if (sessionId == null && !ProtocolElements.JOINROOM_METHOD.equals(request.getMethod())) {
log.warn(
"No session information found for participant with privateId {} when trying to execute method '{}'. Method 'Session.connect()' must be the first operation called in any session",
participantPrivateId, request.getMethod());
throw new OpenViduException(Code.TRANSPORT_ERROR_CODE,
"No session information found for participant with privateId " + participantPrivateId
+ ". Method 'Session.connect()' must be the first operation called in any session");
}
transaction.startAsync(); transaction.startAsync();
@ -106,6 +130,7 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
if (openviduConfig.isOpenViduSecret(secret)) { if (openviduConfig.isOpenViduSecret(secret)) {
sessionManager.newInsecureParticipant(participantPrivatetId); sessionManager.newInsecureParticipant(participantPrivatetId);
token = sessionManager.generateRandomChain();
if (recorder) { if (recorder) {
generateRecorderParticipant = true; generateRecorderParticipant = true;
} }
@ -132,9 +157,9 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
sessionManager.joinRoom(participant, sessionId, request.getId()); sessionManager.joinRoom(participant, sessionId, request.getId());
} else { } else {
log.error("ERROR: Metadata format is incorrect"); log.error("ERROR: Metadata format set in client-side is incorrect");
throw new OpenViduException(Code.USER_METADATA_FORMAT_INVALID_ERROR_CODE, throw new OpenViduException(Code.USER_METADATA_FORMAT_INVALID_ERROR_CODE,
"Unable to join room. The metadata received has an invalid format"); "Unable to join room. The metadata received from the client-side has an invalid format (max length allowed is 10000 chars)");
} }
} else { } else {
log.error("ERROR: sessionId or token not valid"); log.error("ERROR: sessionId or token not valid");
@ -259,6 +284,16 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
@Override @Override
public void afterConnectionClosed(Session rpcSession, String status) throws Exception { public void afterConnectionClosed(Session rpcSession, String status) throws Exception {
log.info("Connection closed for WebSocket session: {} - Status: {}", rpcSession.getSessionId(), status); log.info("Connection closed for WebSocket session: {} - Status: {}", rpcSession.getSessionId(), status);
RpcConnection rpc = this.notificationService.closeRpcSession(rpcSession.getSessionId());
if (rpc != null && rpc.getSessionId() != null) {
io.openvidu.server.core.Session session = this.sessionManager.getSession(rpc.getSessionId());
if (session != null && session.getParticipantByPrivateId(rpc.getParticipantPrivateId()) != null) {
leaveRoomAfterConnClosed(rpc.getParticipantPrivateId());
}
}
this.notificationService.showRpcConnections(); this.notificationService.showRpcConnections();
String rpcSessionId = rpcSession.getSessionId(); String rpcSessionId = rpcSession.getSessionId();
if (this.webSocketTransportError.get(rpcSessionId) != null) { if (this.webSocketTransportError.get(rpcSessionId) != null) {
@ -293,21 +328,24 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
public static String getStringParam(Request<JsonObject> request, String key) { public static String getStringParam(Request<JsonObject> request, String key) {
if (request.getParams() == null || request.getParams().get(key) == null) { if (request.getParams() == null || request.getParams().get(key) == null) {
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod() + "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER"); throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod()
+ "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
} }
return request.getParams().get(key).getAsString(); return request.getParams().get(key).getAsString();
} }
public static int getIntParam(Request<JsonObject> request, String key) { public static int getIntParam(Request<JsonObject> request, String key) {
if (request.getParams() == null || request.getParams().get(key) == null) { if (request.getParams() == null || request.getParams().get(key) == null) {
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod() + "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER"); throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod()
+ "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
} }
return request.getParams().get(key).getAsInt(); return request.getParams().get(key).getAsInt();
} }
public static boolean getBooleanParam(Request<JsonObject> request, String key) { public static boolean getBooleanParam(Request<JsonObject> request, String key) {
if (request.getParams() == null || request.getParams().get(key) == null) { if (request.getParams() == null || request.getParams().get(key) == null) {
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod() + "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER"); throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod()
+ "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
} }
return request.getParams().get(key).getAsBoolean(); return request.getParams().get(key).getAsBoolean();
} }

View File

@ -18,19 +18,22 @@ public class RpcNotificationService {
private static final Logger log = LoggerFactory.getLogger(RpcNotificationService.class); private static final Logger log = LoggerFactory.getLogger(RpcNotificationService.class);
private static ConcurrentMap<String, RpcConnection> rpcConnections = new ConcurrentHashMap<>(); private ConcurrentMap<String, RpcConnection> rpcConnections = new ConcurrentHashMap<>();
public RpcConnection newRpcConnection(Transaction t, Request<JsonObject> request) {
String participantPrivateId = t.getSession().getSessionId();
RpcConnection connection = new RpcConnection(t.getSession());
RpcConnection oldConnection = rpcConnections.putIfAbsent(participantPrivateId, connection);
if (oldConnection != null) {
log.warn("Concurrent initialization of rpcSession #{}", participantPrivateId);
connection = oldConnection;
}
return connection;
}
public RpcConnection addTransaction(Transaction t, Request<JsonObject> request) { public RpcConnection addTransaction(Transaction t, Request<JsonObject> request) {
String participantPrivateId = t.getSession().getSessionId(); String participantPrivateId = t.getSession().getSessionId();
RpcConnection connection = rpcConnections.get(participantPrivateId); RpcConnection connection = rpcConnections.get(participantPrivateId);
if (connection == null) {
connection = new RpcConnection(t.getSession());
RpcConnection oldConnection = rpcConnections.putIfAbsent(participantPrivateId, connection);
if (oldConnection != null) {
log.warn("Concurrent initialization of rpcSession #{}", participantPrivateId);
connection = oldConnection;
}
}
connection.addTransaction(request.getId(), t); connection.addTransaction(request.getId(), t);
return connection; return connection;
} }
@ -82,20 +85,21 @@ public class RpcNotificationService {
} }
} }
public void closeRpcSession(String participantPrivateId) { public RpcConnection closeRpcSession(String participantPrivateId) {
RpcConnection rpcSession = rpcConnections.get(participantPrivateId); RpcConnection rpcSession = rpcConnections.remove(participantPrivateId);
if (rpcSession == null || rpcSession.getSession() == null) { if (rpcSession == null || rpcSession.getSession() == null) {
log.error("No session found for private id {}, unable to cleanup", participantPrivateId); log.error("No session found for private id {}, unable to cleanup", participantPrivateId);
return; return null;
} }
Session s = rpcSession.getSession(); Session s = rpcSession.getSession();
try { try {
s.close(); s.close();
log.info("Closed session for participant with private id {}", participantPrivateId); log.info("Closed session for participant with private id {}", participantPrivateId);
return rpcSession;
} catch (IOException e) { } catch (IOException e) {
log.error("Error closing session for participant with private id {}", participantPrivateId, e); log.error("Error closing session for participant with private id {}", participantPrivateId, e);
} }
rpcConnections.remove(participantPrivateId); return null;
} }
private Transaction getAndRemoveTransaction(String participantPrivateId, Integer transactionId) { private Transaction getAndRemoveTransaction(String participantPrivateId, Integer transactionId) {
@ -111,7 +115,11 @@ public class RpcNotificationService {
} }
public void showRpcConnections() { public void showRpcConnections() {
log.info("<PRIVATE_ID, RPC_CONNECTION>: {}", RpcNotificationService.rpcConnections.toString()); log.info("<PRIVATE_ID, RPC_CONNECTION>: {}", this.rpcConnections.toString());
}
public RpcConnection getRpcConnection(String participantPrivateId) {
return this.rpcConnections.get(participantPrivateId);
} }
} }

View File

@ -0,0 +1,21 @@
spring.profiles.active=docker
server.address: 0.0.0.0
server.ssl.enabled: true
openvidu.recording.version: 1.8.0
server.port: 8443
server.ssl.key-store: classpath:openvidu-selfsigned.jks
server.ssl.key-store-password: openvidu
server.ssl.key-store-type: JKS
server.ssl.key-alias: openvidu-selfsigned
kms.uris=[\"ws://localhost:8888/kurento\"]
openvidu.secret: MY_SECRET
openvidu.publicurl: local
openvidu.cdr: false
openvidu.recording: false
openvidu.recording.path: /opt/openvidu/recordings
openvidu.recording.free-access: false

View File

@ -1 +1 @@
{"version":3,"sources":["webpack/bootstrap 1569d3edbc6f13a7612a"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t\"inline\": 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1569d3edbc6f13a7612a"],"sourceRoot":"webpack:///"} {"version":3,"sources":["webpack/bootstrap 934236eddc4c2d323572"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t\"inline\": 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 934236eddc4c2d323572"],"sourceRoot":"webpack:///"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -201,7 +201,7 @@ public class FakeParticipant implements Closeable {
public void joinRoom() { public void joinRoom() {
try { try {
addPeers(jsonRpcClient.joinRoom(room, name, null)); addPeers(jsonRpcClient.joinRoom(room, name));
log.info("Joined room {}: {} peers", room, peerStreams); log.info("Joined room {}: {} peers", room, peerStreams);
if (autoMedia) { if (autoMedia) {
log.debug("Automedia on, publishing and subscribing to as many as {} publishers", log.debug("Automedia on, publishing and subscribing to as many as {} publishers",

View File

@ -194,6 +194,9 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
this.session.connect(token, this.clientData, (error) => { this.session.connect(token, this.clientData, (error) => {
if (!error) { if (!error) {
this.changeDetector.detectChanges();
if (this.publishTo) { if (this.publishTo) {
this.audioMuted = !this.activeAudio; this.audioMuted = !this.activeAudio;
@ -428,7 +431,14 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
data: 'Test message', data: 'Test message',
to: [], to: [],
type: 'chat' type: 'chat'
}); },
error => {
if (error) {
console.error(error);
} else {
console.log('Message succesfully sent');
}
});
} }
recordPublisher(): void { recordPublisher(): void {