Skip to content
Snippets Groups Projects
Verified Commit cff52d4d authored by Eliot Berriot's avatar Eliot Berriot
Browse files

WIP

parent c5e4ce32
Branches live-streaming
No related tags found
No related merge requests found
......@@ -94,3 +94,5 @@ docs/swagger
_build
front/src/translations.json
front/locales/en_US/LC_MESSAGES/app.po
docker/antmedia/ant-media*
......@@ -133,8 +133,17 @@ services:
volumes:
- "./docs/swagger.yml:/usr/share/nginx/html/swagger.yml"
antmedia:
image: funkwhale/antmedia
ports:
- "5080:5080"
# - "5443:5443"
- "1935:1935"
volumes:
- "/usr/local/antmedia/"
networks:
? internal
internal:
federation:
external:
name: federation
*.zip
FROM debian:9
RUN apt-get update && apt-get install -y libx11-dev wget openjdk-8-jdk jsvc
RUN useradd -d /usr/local/antmedia/ -s /bin/false -r antmedia
USER antmedia
COPY --chown=antmedia:antmedia ./ant-media-server /usr/local/antmedia
WORKDIR /usr/local/antmedia
RUN mkdir log
RUN sed -i '/JAVA_HOME="\/usr\/lib\/jvm\/java-8-oracle"/c\JAVA_HOME="\/usr\/lib\/jvm\/java-8-openjdk-amd64"' ./antmedia
COPY ./server.sh ./server.sh
CMD './server.sh'
EXPOSE 1935 5080 5443
# Build antmedia docker image
```
wget https://github.com/ant-media/Ant-Media-Server/releases/download/ams-v1.5.2/ant-media-server-community-1.5.2-181116_1126.zip
unzip ant-media-server-community-1.5.2-181116_1126.zip
docker build -t funkwhale/antmedia .
```
#!/bin/bash -eux
EXEC="/usr/bin/jsvc"
NAME="antmedia"
# The path to the folder containing daemon jar
FILE_PATH="/usr/local/$NAME"
export RED5_HOME=$FILE_PATH;
echo "Path $FILE_PATH";
ulimit -n 65536
# The path to the folder containing the java runtime
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
# Our classpath including our jar file and the Apache Commons Daemon library
CLASS_PATH="$FILE_PATH/commons-daemon-1.0.15.jar:$FILE_PATH/ant-media-server-service.jar:$FILE_PATH/conf"
# The fully qualified name of the class to execute
CLASS="org.red5.daemon.EngineLauncher"
# Any command line arguments to be passed to the our Java Daemon implementations init() method
ARGS="9999"
# The file that will contain our process identification number (pid) for other scripts/programs that need to access it.
PID="/tmp/$NAME.pid"
# System.out writes to this file...
LOG_OUT="$FILE_PATH/log/$NAME-service.log"
# System.err writes to this file...
LOG_ERR="/dev/stderr"
# LOG_ERR="$FILE_PATH/log/$NAME-error.log"
LD_LIBRARY_PATH=$FILE_PATH/lib/native
export LD_LIBRARY_PATH
# Native path
NATIVE="-Djava.library.path=$LD_LIBRARY_PATH"
# JAVA options
# You can set JVM additional options here if you want
JVM_OPTS="-Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true -XX:+UseG1GC"
# Set up logging options
LOGGING_OPTS="-Dlogback.ContextSelector=org.red5.logging.LoggingContextSelector -Dcatalina.useNaming=true"
# Set up security options
SECURITY_OPTS="-Djava.security.debug=failure -Djava.security.egd=file:/dev/./urandom"
# Set up tomcat options
TOMCAT_OPTS="-Dcatalina.home=$RED5_HOME"
ADDITIONAL_OPTS="-Djava.library.path=$RED5_HOME/lib/native"
JAVA_OPTS="$LOGGING_OPTS $SECURITY_OPTS $JVM_OPTS $NATIVE $TOMCAT_OPTS $ADDITIONAL_OPTS"
exec $EXEC -nodetach -home $JAVA_HOME -user antmedia -cp $CLASS_PATH -cwd $RED5_HOME $JAVA_OPTS -errfile $LOG_ERR -pidfile $PID $CLASS $ARGS
......@@ -2,156 +2,35 @@
<div class="main pusher" v-title="labels.title">
<div class="ui vertical aligned stripe segment">
<div>
<h1>Join a video session</h1>
<h1>Stream url</h1>
<p>
<label>Session:</label>
<input type="text" v-model="sessionName">
</p>
<p>
<button @click="joinSession(true)">Join and publish</button>
<button @click="joinSession(false)">Join</button>
<label>Url:</label>
<input type="text" v-model="streamUrl">
</p>
</div>
<div v-if="streamUrl">
HELLO
<audio :src="streamUrl"></audio>
<div id="session">
<h1 id="session-header"></h1>
<input v-if="session" type="button" @click="session.disconnect()" value="LEAVE">
<div>
<div id="publisher"><h3>YOU</h3></div>
<div id="subscriber"><h3>OTHERS</h3></div>
</div>
</div>
</div>
</div>
</template>
<script>
import axios from "axios";
import "openvidu-browser/static/js/openvidu-browser-2.6.0";
export default {
data() {
return {
sessionName: "hello2",
session: null,
serverUrl: "https://" + location.hostname + ":4443/api/",
serverSecret: "MY_SECRET"
streamUrl: null,
};
},
created() {},
destroyed() {
if (this.session) {
this.session.disconnect();
}
},
computed: {
labels() {
return {
title: this.$gettext("Live streams")
};
},
client() {
let headers = {
Authorization: "Basic " + btoa("OPENVIDUAPP:" + this.serverSecret),
"Content-Type": "application/json"
};
return axios.create({
baseURL: this.serverUrl,
timeout: 1000,
headers: headers
});
}
},
methods: {
joinSession(publish) {
let OV = new OpenVidu();
this.session = OV.initSession();
let session = this.session;
session.on("streamCreated", function(event) {
let subscriber = session.subscribe(event.stream, "subscriber", {
subscribeToAudio: true,
subscribeToVideo: false,
});
});
this.getToken(this.sessionName).then(token => {
session
.connect(token)
.then(() => {
if (publish) {
let publisher = OV.initPublisher("publisher", {
publishAudio: true,
publishVideo: false
});
session.publish(publisher);
}
})
.catch(error => {
console.log(
"There was an error connecting to the session:",
error.code,
error.message
);
});
});
},
getToken(mySessionId) {
let self = this;
return this.createSession(mySessionId).then(sessionId =>
self.createToken(sessionId)
);
},
createSession(sessionId) {
// See https://openvidu.io/docs/reference-docs/REST-API/#post-apisessions
let self = this;
return new Promise((resolve, reject) => {
self.client
.post(self.serverUrl + "sessions", { customSessionId: sessionId })
.then(
response => {
resolve(response.data.id);
},
error => {
if (error.response.status === 409) {
resolve(sessionId);
} else {
console.warn(
"No connection to OpenVidu Server. This may be a certificate error at " +
self.serverUrl
);
if (
window.confirm(
'No connection to OpenVidu Server. This may be a certificate error at "' +
self.serverUrl +
'"\n\nClick OK to navigate and accept it. ' +
'If no certificate warning is shown, then check that your OpenVidu Server is up and running at "' +
self.serverUrl +
'"'
)
) {
location.assign(self.serverUrl + "/accept-certificate");
}
}
}
);
});
},
createToken(sessionId) {
// See https://openvidu.io/docs/reference-docs/REST-API/#post-apitokens
let self = this;
return new Promise((resolve, reject) => {
self.client
.post(self.serverUrl + "tokens", { session: sessionId })
.then(
response => {
resolve(response.data.token);
},
error => {
reject(error);
}
);
});
}
}
};
</script>
......
openvidu-tutorials @ 2e10ab82
Subproject commit 2e10ab8296292fcbf9dc75e39f89343e4dc555c1
$ docker run -p 4443:4443 --rm -e openvidu.secret=MY_SECRET openvidu/openvidu-server-kms
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment