mirror of https://github.com/OpenVidu/openvidu.git
OpenVidu publicurl bug fix for Docker containers. Startup logs improved for recording parameters
parent
5e59ac1890
commit
e865e216d0
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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.jar"
|
command=/bin/bash -c "java -jar -Dspring.profiles.active=docker /openvidu-server.jar"
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|
|
@ -5,5 +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.jar"
|
command=/bin/bash -c "java -jar -Dspring.profiles.active=docker /openvidu-server.jar"
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|
|
@ -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 { }
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 : '8443') +
|
||||||
|
'/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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -148,14 +148,14 @@ public class OpenViduServer implements JsonRpcConfigurer {
|
||||||
NEW_LINE + ngrok.getNgrokAppUrl() +
|
NEW_LINE + ngrok.getNgrokAppUrl() +
|
||||||
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 +164,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);
|
||||||
|
@ -215,7 +212,7 @@ public class OpenViduServer implements JsonRpcConfigurer {
|
||||||
if (recordingModuleEnabled) {
|
if (recordingModuleEnabled) {
|
||||||
ComposedRecordingService recordingService = context.getBean(ComposedRecordingService.class);
|
ComposedRecordingService recordingService = context.getBean(ComposedRecordingService.class);
|
||||||
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 +220,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,11 +255,13 @@ 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");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("OpenVidu Server using " + type + " URL: [" + OpenViduServer.publicUrl + "]");
|
recordingService.initRecordingPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("OpenVidu Server using " + type + " URL: [" + OpenViduServer.publicUrl + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getContainerIp() throws IOException, InterruptedException {
|
private static String getContainerIp() throws IOException, InterruptedException {
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()) {
|
||||||
|
|
|
@ -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]);
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
|
@ -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 ea96a76fbedd04f4a59b"],"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 ea96a76fbedd04f4a59b"],"sourceRoot":"webpack:///"}
|
|
@ -15080,11 +15080,12 @@ var AppMaterialModule = (function () {
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__app_routing__ = __webpack_require__("./src/app/app.routing.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__app_routing__ = __webpack_require__("./src/app/app.routing.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_app_app_material_module__ = __webpack_require__("./src/app/app.material.module.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_app_app_material_module__ = __webpack_require__("./src/app/app.material.module.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__services_info_service__ = __webpack_require__("./src/app/services/info.service.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__services_info_service__ = __webpack_require__("./src/app/services/info.service.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__app_component__ = __webpack_require__("./src/app/app.component.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__services_rest_service__ = __webpack_require__("./src/app/services/rest.service.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_dashboard_dashboard_component__ = __webpack_require__("./src/app/components/dashboard/dashboard.component.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__app_component__ = __webpack_require__("./src/app/app.component.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__components_session_details_session_details_component__ = __webpack_require__("./src/app/components/session-details/session-details.component.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__components_dashboard_dashboard_component__ = __webpack_require__("./src/app/components/dashboard/dashboard.component.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_dashboard_credentials_dialog_component__ = __webpack_require__("./src/app/components/dashboard/credentials-dialog.component.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_session_details_session_details_component__ = __webpack_require__("./src/app/components/session-details/session-details.component.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__components_layouts_layout_best_fit_layout_best_fit_component__ = __webpack_require__("./src/app/components/layouts/layout-best-fit/layout-best-fit.component.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__components_dashboard_credentials_dialog_component__ = __webpack_require__("./src/app/components/dashboard/credentials-dialog.component.ts");
|
||||||
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__components_layouts_layout_best_fit_layout_best_fit_component__ = __webpack_require__("./src/app/components/layouts/layout-best-fit/layout-best-fit.component.ts");
|
||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
@ -15105,17 +15106,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var AppModule = (function () {
|
var AppModule = (function () {
|
||||||
function AppModule() {
|
function AppModule() {
|
||||||
}
|
}
|
||||||
AppModule = __decorate([
|
AppModule = __decorate([
|
||||||
Object(__WEBPACK_IMPORTED_MODULE_2__angular_core__["K" /* NgModule */])({
|
Object(__WEBPACK_IMPORTED_MODULE_2__angular_core__["K" /* NgModule */])({
|
||||||
declarations: [
|
declarations: [
|
||||||
__WEBPACK_IMPORTED_MODULE_9__app_component__["a" /* AppComponent */],
|
__WEBPACK_IMPORTED_MODULE_10__app_component__["a" /* AppComponent */],
|
||||||
__WEBPACK_IMPORTED_MODULE_10__components_dashboard_dashboard_component__["a" /* DashboardComponent */],
|
__WEBPACK_IMPORTED_MODULE_11__components_dashboard_dashboard_component__["a" /* DashboardComponent */],
|
||||||
__WEBPACK_IMPORTED_MODULE_11__components_session_details_session_details_component__["a" /* SessionDetailsComponent */],
|
__WEBPACK_IMPORTED_MODULE_12__components_session_details_session_details_component__["a" /* SessionDetailsComponent */],
|
||||||
__WEBPACK_IMPORTED_MODULE_12__components_dashboard_credentials_dialog_component__["a" /* CredentialsDialogComponent */],
|
__WEBPACK_IMPORTED_MODULE_13__components_dashboard_credentials_dialog_component__["a" /* CredentialsDialogComponent */],
|
||||||
__WEBPACK_IMPORTED_MODULE_13__components_layouts_layout_best_fit_layout_best_fit_component__["a" /* LayoutBestFitComponent */],
|
__WEBPACK_IMPORTED_MODULE_14__components_layouts_layout_best_fit_layout_best_fit_component__["a" /* LayoutBestFitComponent */],
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
__WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__["a" /* BrowserModule */],
|
__WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__["a" /* BrowserModule */],
|
||||||
|
@ -15126,10 +15128,10 @@ var AppModule = (function () {
|
||||||
__WEBPACK_IMPORTED_MODULE_1__angular_flex_layout__["a" /* FlexLayoutModule */]
|
__WEBPACK_IMPORTED_MODULE_1__angular_flex_layout__["a" /* FlexLayoutModule */]
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
__WEBPACK_IMPORTED_MODULE_12__components_dashboard_credentials_dialog_component__["a" /* CredentialsDialogComponent */],
|
__WEBPACK_IMPORTED_MODULE_13__components_dashboard_credentials_dialog_component__["a" /* CredentialsDialogComponent */],
|
||||||
],
|
],
|
||||||
providers: [__WEBPACK_IMPORTED_MODULE_8__services_info_service__["a" /* InfoService */]],
|
providers: [__WEBPACK_IMPORTED_MODULE_8__services_info_service__["a" /* InfoService */], __WEBPACK_IMPORTED_MODULE_9__services_rest_service__["a" /* RestService */]],
|
||||||
bootstrap: [__WEBPACK_IMPORTED_MODULE_9__app_component__["a" /* AppComponent */]]
|
bootstrap: [__WEBPACK_IMPORTED_MODULE_10__app_component__["a" /* AppComponent */]]
|
||||||
})
|
})
|
||||||
], AppModule);
|
], AppModule);
|
||||||
return AppModule;
|
return AppModule;
|
||||||
|
@ -15233,9 +15235,10 @@ module.exports = "<div id=\"dashboard-div\" fxLayout=\"row\" fxLayout.xs=\"colum
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_material__ = __webpack_require__("./node_modules/@angular/material/esm5/material.es5.js");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_material__ = __webpack_require__("./node_modules/@angular/material/esm5/material.es5.js");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__services_info_service__ = __webpack_require__("./src/app/services/info.service.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__services_info_service__ = __webpack_require__("./src/app/services/info.service.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_openvidu_browser__ = __webpack_require__("../../../../openvidu-browser/lib/OpenVidu/index.js");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__services_rest_service__ = __webpack_require__("./src/app/services/rest.service.ts");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_openvidu_browser___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_openvidu_browser__);
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_openvidu_browser__ = __webpack_require__("../../../../openvidu-browser/lib/OpenVidu/index.js");
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__credentials_dialog_component__ = __webpack_require__("./src/app/components/dashboard/credentials-dialog.component.ts");
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_openvidu_browser___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_openvidu_browser__);
|
||||||
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__credentials_dialog_component__ = __webpack_require__("./src/app/components/dashboard/credentials-dialog.component.ts");
|
||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
@ -15250,10 +15253,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var DashboardComponent = (function () {
|
var DashboardComponent = (function () {
|
||||||
function DashboardComponent(infoService, dialog) {
|
function DashboardComponent(infoService, restService, dialog) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.infoService = infoService;
|
this.infoService = infoService;
|
||||||
|
this.restService = restService;
|
||||||
this.dialog = dialog;
|
this.dialog = dialog;
|
||||||
this.lockScroll = false;
|
this.lockScroll = false;
|
||||||
this.info = [];
|
this.info = [];
|
||||||
|
@ -15287,6 +15292,13 @@ var DashboardComponent = (function () {
|
||||||
console.log(event.data);
|
console.log(event.data);
|
||||||
_this.infoService.updateInfo(event.data);
|
_this.infoService.updateInfo(event.data);
|
||||||
};
|
};
|
||||||
|
this.restService.getOpenViduPublicUrl()
|
||||||
|
.then(function (url) {
|
||||||
|
_this.openviduPublicUrl = url.replace('https://', 'wss://').replace('http://', 'ws://');
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
DashboardComponent.prototype.beforeunloadHandler = function () {
|
DashboardComponent.prototype.beforeunloadHandler = function () {
|
||||||
// On window closed leave test session and close info websocket
|
// On window closed leave test session and close info websocket
|
||||||
|
@ -15313,19 +15325,30 @@ var DashboardComponent = (function () {
|
||||||
DashboardComponent.prototype.testVideo = function () {
|
DashboardComponent.prototype.testVideo = function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var dialogRef;
|
var dialogRef;
|
||||||
dialogRef = this.dialog.open(__WEBPACK_IMPORTED_MODULE_4__credentials_dialog_component__["a" /* CredentialsDialogComponent */]);
|
dialogRef = this.dialog.open(__WEBPACK_IMPORTED_MODULE_5__credentials_dialog_component__["a" /* CredentialsDialogComponent */]);
|
||||||
dialogRef.componentInstance.myReference = dialogRef;
|
dialogRef.componentInstance.myReference = dialogRef;
|
||||||
dialogRef.afterClosed().subscribe(function (secret) {
|
dialogRef.afterClosed().subscribe(function (secret) {
|
||||||
if (secret) {
|
if (secret) {
|
||||||
var port = (location.port) ? location.port : '8443';
|
if (!_this.openviduPublicUrl) {
|
||||||
_this.connectToSession('wss://' + location.hostname + ':' + port + '/testSession?secret=' + secret);
|
_this.restService.getOpenViduPublicUrl()
|
||||||
|
.then((function (url) {
|
||||||
|
_this.openviduPublicUrl = url.replace('https://', 'wss://').replace('http://', 'ws://');
|
||||||
|
_this.connectToSession(_this.openviduPublicUrl + 'testSession?secret=' + secret);
|
||||||
|
}))
|
||||||
|
.catch(function (error) {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_this.connectToSession(_this.openviduPublicUrl + 'testSession?secret=' + secret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
DashboardComponent.prototype.connectToSession = function (mySessionId) {
|
DashboardComponent.prototype.connectToSession = function (mySessionId) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.msgChain = [];
|
this.msgChain = [];
|
||||||
var OV = new __WEBPACK_IMPORTED_MODULE_3_openvidu_browser__["OpenVidu"]();
|
var OV = new __WEBPACK_IMPORTED_MODULE_4_openvidu_browser__["OpenVidu"]();
|
||||||
this.session = OV.initSession(mySessionId);
|
this.session = OV.initSession(mySessionId);
|
||||||
this.testStatus = 'CONNECTING';
|
this.testStatus = 'CONNECTING';
|
||||||
this.testButton = 'Testing...';
|
this.testButton = 'Testing...';
|
||||||
|
@ -15367,7 +15390,7 @@ var DashboardComponent = (function () {
|
||||||
if (error.code === 401) {
|
if (error.code === 401) {
|
||||||
_this.endTestVideo();
|
_this.endTestVideo();
|
||||||
var dialogRef = void 0;
|
var dialogRef = void 0;
|
||||||
dialogRef = _this.dialog.open(__WEBPACK_IMPORTED_MODULE_4__credentials_dialog_component__["a" /* CredentialsDialogComponent */]);
|
dialogRef = _this.dialog.open(__WEBPACK_IMPORTED_MODULE_5__credentials_dialog_component__["a" /* CredentialsDialogComponent */]);
|
||||||
dialogRef.componentInstance.myReference = dialogRef;
|
dialogRef.componentInstance.myReference = dialogRef;
|
||||||
dialogRef.afterClosed().subscribe(function (secret) {
|
dialogRef.afterClosed().subscribe(function (secret) {
|
||||||
if (secret) {
|
if (secret) {
|
||||||
|
@ -15416,7 +15439,7 @@ var DashboardComponent = (function () {
|
||||||
template: __webpack_require__("./src/app/components/dashboard/dashboard.component.html"),
|
template: __webpack_require__("./src/app/components/dashboard/dashboard.component.html"),
|
||||||
styles: [__webpack_require__("./src/app/components/dashboard/dashboard.component.css")],
|
styles: [__webpack_require__("./src/app/components/dashboard/dashboard.component.css")],
|
||||||
}),
|
}),
|
||||||
__metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_2__services_info_service__["a" /* InfoService */], __WEBPACK_IMPORTED_MODULE_1__angular_material__["d" /* MatDialog */]])
|
__metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_2__services_info_service__["a" /* InfoService */], __WEBPACK_IMPORTED_MODULE_3__services_rest_service__["a" /* RestService */], __WEBPACK_IMPORTED_MODULE_1__angular_material__["d" /* MatDialog */]])
|
||||||
], DashboardComponent);
|
], DashboardComponent);
|
||||||
return DashboardComponent;
|
return DashboardComponent;
|
||||||
}());
|
}());
|
||||||
|
@ -15970,6 +15993,59 @@ var InfoService = (function () {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./src/app/services/rest.service.ts":
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RestService; });
|
||||||
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||||
|
};
|
||||||
|
|
||||||
|
var RestService = (function () {
|
||||||
|
function RestService() {
|
||||||
|
}
|
||||||
|
RestService.prototype.getOpenViduPublicUrl = function () {
|
||||||
|
var _this = this;
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
if (!!_this.openviduPublicUrl) {
|
||||||
|
resolve(_this.openviduPublicUrl);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var url = location.protocol + '//' + location.hostname + ':' + (!!location.port ? location.port : '8443') +
|
||||||
|
'/config/openvidu-publicurl';
|
||||||
|
var http_1 = new XMLHttpRequest();
|
||||||
|
http_1.onreadystatechange = function () {
|
||||||
|
if (http_1.readyState === 4) {
|
||||||
|
if (http_1.status === 200) {
|
||||||
|
_this.openviduPublicUrl = http_1.responseText;
|
||||||
|
resolve(http_1.responseText);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
reject('Error getting OpenVidu publicurl');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
};
|
||||||
|
http_1.open('GET', url, true);
|
||||||
|
http_1.send();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
RestService = __decorate([
|
||||||
|
Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["C" /* Injectable */])()
|
||||||
|
], RestService);
|
||||||
|
return RestService;
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/environments/environment.ts":
|
/***/ "./src/environments/environment.ts":
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue