mirror of https://github.com/OpenVidu/openvidu.git
openvidu-testapp Docker container
parent
c2b3c46969
commit
bb05d019bc
|
@ -0,0 +1,28 @@
|
|||
FROM ubuntu:16.04
|
||||
MAINTAINER openvidu@gmail.com
|
||||
|
||||
# Install Kurento Media Server (KMS)
|
||||
RUN echo "deb http://ubuntu.kurento.org xenial kms6" | tee /etc/apt/sources.list.d/kurento.list \
|
||||
&& apt-key adv --keyserver keyserver.ubuntu.com --recv 2F819BC0 \
|
||||
&& apt-get update \
|
||||
&& apt-get -y dist-upgrade \
|
||||
&& apt-get -y install kurento-media-server-6.0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Java
|
||||
RUN apt-get update && apt-get install -y openjdk-8-jdk && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Configure Supervisor
|
||||
RUN mkdir -p /var/log/supervisor
|
||||
RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy all files
|
||||
COPY kms.sh /kms.sh
|
||||
COPY web /web/
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY openvidu-server.jar openvidu-server.jar
|
||||
|
||||
EXPOSE 8443
|
||||
|
||||
# Exec supervisord
|
||||
CMD ["/usr/bin/supervisord"]
|
|
@ -0,0 +1,19 @@
|
|||
# Copy compiled openvidu-server.jar
|
||||
cp ../../openvidu-server/target/openvidu-server-"$1".jar ./openvidu-server.jar
|
||||
|
||||
# Build and copy openvidu-testapp static files
|
||||
cd ../
|
||||
ng build
|
||||
cp -a dist/. ./docker/web/
|
||||
cd docker
|
||||
|
||||
# Modify WebSocket protocol in app.js for allowing both ngrok and localhost connections
|
||||
sed -i 's/OV\.initSession("wss:\/\/"/OV\.initSession("ws:\/\/"/g' ./web/app.js
|
||||
|
||||
# Build docker image
|
||||
docker build -t openvidu/testapp .
|
||||
|
||||
# Delete unwanted files
|
||||
rm -rf ./web
|
||||
rm -rf ./openvidu-server
|
||||
rm openvidu-server.jar
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash -x
|
||||
set -e
|
||||
|
||||
if [ -n "$KMS_TURN_URL" ]; then
|
||||
echo "turnURL=$KMS_TURN_URL" > /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini
|
||||
fi
|
||||
|
||||
if [ -n "$KMS_STUN_IP" -a -n "$KMS_STUN_PORT" ]; then
|
||||
# Generate WebRtcEndpoint configuration
|
||||
echo "stunServerAddress=$KMS_STUN_IP" > /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini
|
||||
echo "stunServerPort=$KMS_STUN_PORT" >> /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini
|
||||
fi
|
||||
|
||||
# Remove ipv6 local loop until ipv6 is supported
|
||||
cat /etc/hosts | sed '/::1/d' | tee /etc/hosts > /dev/null
|
||||
|
||||
export GST_DEBUG=Kurento*:5
|
||||
|
||||
exec /usr/bin/kurento-media-server "$@"
|
|
@ -0,0 +1,13 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/log/supervisor/supervisord.log;
|
||||
pidfile=/var/run/supervisord.pid;
|
||||
loglevel=debug
|
||||
|
||||
[program:kms]
|
||||
command=/bin/bash /kms.sh
|
||||
redirect_stderr=true
|
||||
|
||||
[program:openvidu-server]
|
||||
command=/bin/bash -c "java -Dserver.port=8443 -Dsecurity.ignored=/** -Dspring.resources.static-locations=file:///web/ -jar /openvidu-server.jar"
|
||||
redirect_stderr=true
|
|
@ -247,6 +247,14 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
|
||||
|
||||
private leaveSession(): void {
|
||||
if (!!this.publisherRecorder) {
|
||||
this.restartPublisherRecord();
|
||||
}
|
||||
Object.keys(this.subscribers).forEach((key) => {
|
||||
if (!!this.subscribers[key].recorder) {
|
||||
this.restartSubscriberRecord(key);
|
||||
}
|
||||
});
|
||||
if (this.session) {
|
||||
this.session.disconnect();
|
||||
}
|
||||
|
@ -446,13 +454,12 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.afterOpenPreview(this.publisherRecorder);
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(() => {
|
||||
this.afterClosePreview(this.publisherRecorder);
|
||||
this.afterClosePreview();
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error stopping LocalRecorder: ' + error);
|
||||
});
|
||||
this.restartPublisherRecord();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,13 +499,12 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.afterOpenPreview(this.subscribers[connectionId].recorder);
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(() => {
|
||||
this.afterClosePreview(this.subscribers[connectionId].recorder);
|
||||
this.afterClosePreview(connectionId);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error stopping LocalRecorder: ' + error);
|
||||
});
|
||||
this.restartSubscriberRecord(connectionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,9 +525,6 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
if (this.unpublished) {
|
||||
this.session.publish(this.publisher);
|
||||
} else {
|
||||
if (!!this.publisherRecorder && this.publisherRecording) {
|
||||
this.publisherRecorder.clean();
|
||||
}
|
||||
this.session.unpublish(this.publisher);
|
||||
this.removeUserData(this.session.connection.connectionId);
|
||||
this.restartPublisherRecord();
|
||||
|
@ -535,6 +538,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
if (!this.unpublished) {
|
||||
this.session.unpublish(this.publisher);
|
||||
this.removeUserData(this.session.connection.connectionId);
|
||||
this.restartPublisherRecord();
|
||||
}
|
||||
|
||||
let screenChange;
|
||||
|
@ -600,9 +604,6 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
subUnsubFromSubscriber(connectionId: string) {
|
||||
let subscriber: Subscriber = this.subscribers[connectionId].subscriber;
|
||||
if (this.subscribers[connectionId].subbed) {
|
||||
if (!!this.subscribers[connectionId].recorder && this.subscribers[connectionId].recording) {
|
||||
this.subscribers[connectionId].recorder.clean();
|
||||
}
|
||||
this.session.unsubscribe(subscriber);
|
||||
this.restartSubscriberRecord(connectionId);
|
||||
document.getElementById('data-' + this.session.connection.connectionId + '-' + connectionId).style.marginLeft = '0';
|
||||
|
@ -738,15 +739,20 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
|
||||
private afterOpenPreview(recorder: LocalRecorder): void {
|
||||
this.muteSubscribersService.updateMuted(true);
|
||||
recorder.preview('local-recorder-preview').controls = true;
|
||||
recorder.preview('recorder-preview').controls = true;
|
||||
}
|
||||
|
||||
private afterClosePreview(recorder: LocalRecorder): void {
|
||||
private afterClosePreview(connectionId?: string): void {
|
||||
this.muteSubscribersService.updateMuted(false);
|
||||
recorder.clean();
|
||||
if (!!connectionId) {
|
||||
this.restartSubscriberRecord(connectionId);
|
||||
} else {
|
||||
this.restartPublisherRecord();
|
||||
}
|
||||
}
|
||||
|
||||
private restartPublisherRecord(): void {
|
||||
if (!!this.session) {
|
||||
let el: HTMLElement = document.getElementById('local-record-icon-' + this.session.connection.connectionId);
|
||||
if (!!el) {
|
||||
el.innerHTML = 'fiber_manual_record';
|
||||
|
@ -759,11 +765,16 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
if (!!el) {
|
||||
el.style.display = 'none';
|
||||
}
|
||||
}
|
||||
this.publisherPaused = false;
|
||||
this.publisherRecording = false;
|
||||
if (!!this.publisherRecorder) {
|
||||
this.publisherRecorder.clean();
|
||||
}
|
||||
}
|
||||
|
||||
private restartSubscriberRecord(connectionId: string): void {
|
||||
if (!!this.session) {
|
||||
let el: HTMLElement = document.getElementById('record-icon-' + this.session.connection.connectionId + '-' + connectionId);
|
||||
if (!!el) {
|
||||
el.innerHTML = 'fiber_manual_record';
|
||||
|
@ -776,8 +787,13 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
if (!!el) {
|
||||
el.style.display = 'none';
|
||||
}
|
||||
}
|
||||
this.subscribers[connectionId].recording = false;
|
||||
this.subscribers[connectionId].paused = false;
|
||||
|
||||
if (!!this.subscribers[connectionId].recorder) {
|
||||
this.subscribers[connectionId].recorder.clean();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { LocalRecorder } from 'openvidu-browser';
|
|||
selector: 'app-local-recording-dialog',
|
||||
template: `
|
||||
<div mat-dialog-content>
|
||||
<div id="local-recorder-preview"></div>
|
||||
<div id="recorder-preview"></div>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button mat-dialog-close>Close</button>
|
||||
|
|
|
@ -122,7 +122,7 @@ button {
|
|||
margin: 3px 0 !important;
|
||||
}
|
||||
|
||||
#local-recorder-preview video {
|
||||
#recorder-preview video {
|
||||
width: 500px;
|
||||
height: inherit;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue