Tweak config changes, add functionality in server.ts
Still needs an API and a UI, then good to go.merge-requests/25/head
parent
4ff4a6329d
commit
44cc3213ca
|
@ -60,4 +60,8 @@ chat:
|
||||||
|
|
||||||
twitch_mirror:
|
twitch_mirror:
|
||||||
# enable to allow users to mirror video streams to twitch
|
# enable to allow users to mirror video streams to twitch
|
||||||
enabled: false
|
# for those with truly no bandwidth limits
|
||||||
|
enabled: false
|
||||||
|
# https://stream.twitch.tv/ingests/
|
||||||
|
# do not include {stream_key}
|
||||||
|
ingest: 'rtmp://live-ord02.twitch.tv/app/
|
|
@ -83,7 +83,8 @@ const config: Object = {
|
||||||
}, localconfig['chat']['twitch'])
|
}, localconfig['chat']['twitch'])
|
||||||
},
|
},
|
||||||
twitch_mirror: Object.assign({
|
twitch_mirror: Object.assign({
|
||||||
enabled: false
|
enabled: false,
|
||||||
|
ingest: null
|
||||||
}, localconfig['twitch_mirror'])
|
}, localconfig['twitch_mirror'])
|
||||||
};
|
};
|
||||||
export { config };
|
export { config };
|
|
@ -68,6 +68,15 @@ function init () {
|
||||||
console.log('[NodeMediaServer] Skipping recording for stream:',id);
|
console.log('[NodeMediaServer] Skipping recording for stream:',id);
|
||||||
}
|
}
|
||||||
db.query('update user_meta set live=true where username=\''+results[0].username+'\' limit 1');
|
db.query('update user_meta set live=true where username=\''+results[0].username+'\' limit 1');
|
||||||
|
db.query('SELECT twitch_key,enabled from twitch_mirror where username='+db.raw.escape(results[0].username)+' limit 1').then(async (tm) => {
|
||||||
|
if(!tm[0]['enabled'] || !config['twitch_mirror']['enabled'] || !config['twitch_mirror']['ingest']) return;
|
||||||
|
else
|
||||||
|
execFile(config['media']['ffmpeg'], ['-loglevel', 'fatal', '-i', 'rtmp://127.0.0.1:'+config['rtmp']['port']+'/'+config['media']['privateEndpoint']+'/'+key, '-vcodec', 'libx264', '-acodec', 'libaac', '-f', 'flv', config['twitch_mirror']['ingest']+tm[0]['twitch_key']], {
|
||||||
|
detached: true,
|
||||||
|
stdio : 'inherit',
|
||||||
|
maxBuffer: Infinity
|
||||||
|
}).unref();
|
||||||
|
});
|
||||||
console.log('[NodeMediaServer] Stream key ok for stream:',id);
|
console.log('[NodeMediaServer] Stream key ok for stream:',id);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
Reference in New Issue