make STREAM_NAME configurable, add admin interface for mediaserver

This commit is contained in:
Reaby committed 2020-05-13 23:27:46 +03:00
1 parent f826752ed9
commit a6fc4c6cbe
5 files changed
+14 -10

No files matched your search

+4 -1
View File
@@ -44,7 +44,10 @@ set following options:<br/>
|URL:| `rtmp://localhost/live`|
|Stream key:|`STREAM_NAME`|
Later it is possible to define other stream names/keys too, but for now only this one is supported.
# Mediaserver status and adminpanel
Admin interface is located at: http://localhost:8001/admin
You can use same crendetials as configured at main app
# Environment variables
|ENV|default|Usage|
+6 -5
View File
@@ -74,11 +74,12 @@ if (config.mediaServer) {
http: {
port: (parseInt(config.serverListenPort) + 1),
allow_origin: '*',
auth: {
api: true,
api_user: config.admins[0].username,
api_pass: config.admins[0].password
}
},
auth: {
api: true,
api_user: config.admins[0].username,
api_pass: config.admins[0].password,
}
};
+1
View File
@@ -5,6 +5,7 @@ module.exports = {
"serverHost": process.env.HOST || "127.0.0.1",
"serverUrl": "http://" + (process.env.HOST || "127.0.0.1"), // used for web client
"sessionKey": "generateRandomStringForSecret",
"streamKey": 'STREAM_NAME',
"useLocalAssets": false, // used to load javascript libraries locally from /public/assets
"mediaServer": false, // local streaming server for rtmp, see docs how to use
"defaultLocale": "en",
+2 -3
View File
@@ -124,17 +124,16 @@ class admin {
});
socket.on('controls.startStream', function (data) {
socket.on('controls.startStream', function () {
let view = self.getView();
let serverOptions = self.getServerOptions();
if (serverOptions.isStreaming === false) {
serverOptions.loop = false;
serverOptions.streamSource = "http://" + config.serverHost + ":" + (config.serverListenPort + 1) + "/live/" + data.streamName + ".flv";
serverOptions.streamSource = "http://" + config.serverHost + ":" + (config.serverListenPort + 1) + "/live/" + config.streamKey + ".flv";
serverOptions.isStreaming = true;
cli.success("start stream");
} else {
serverOptions.loop = true;
serverOptions.isStreaming = false;
serverOptions.streamSource = "";
+1 -1
View File
@@ -153,7 +153,7 @@
</button>
{% if config.mediaServer %}
<button id="stream" class="ui blue basic button"
onclick="emit('controls.startStream', {streamName: 'STREAM_NAME' });">
onclick="emit('controls.startStream');">
{{ t("actions.startStream") }}
</button>
{% endif %}