Skip to content

Instantly share code, notes, and snippets.

@digitallysavvy
Created July 23, 2019 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitallysavvy/05dda8a50b929d547d00444a782ce8cf to your computer and use it in GitHub Desktop.
Save digitallysavvy/05dda8a50b929d547d00444a782ce8cf to your computer and use it in GitHub Desktop.
A Javascript snippet of the configuration for setting up Agora.io's RTMP Broadcasting
function setTranscodingConfig() {
console.log("save rtmp config");
var width = parseInt($('#window-scale-width').val(), 10);
var height = parseInt($('#window-scale-height').val(), 10);
var configRtmp = {
width: width,
height: height,
videoBitrate: parseInt($('#video-bitrate').val(), 10),
videoFramerate: parseInt($('#framerate').val(), 10),
lowLatency: ($('#low-latancy').val() === 'true'),
audioSampleRate: parseInt($('#audio-sample-rate').val(), 10),
audioBitrate: parseInt($('#audio-bitrate').val(), 10),
audioChannels: parseInt($('#audio-channels').val(), 10),
videoGop: parseInt($('#video-gop').val(), 10),
videoCodecProfile: parseInt($('#video-codec-profile').val(), 10),
userCount: 1,
userConfigExtraInfo: {},
backgroundColor: parseInt($('#background-color-picker').val(), 16),
transcodingUsers: [{
uid: localStreams.uid,
alpha: 1,
width: width,
height: height,
x: 0,
y: 0,
zOrder: 0
}],
};
// set live transcoding config
client.setLiveTranscoding(configRtmp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment