From b81dd6d1ed11363f78265f727b8892c99e765e84 Mon Sep 17 00:00:00 2001 From: Lorenzo Miniero Date: Mon, 8 Feb 2021 16:26:19 +0100 Subject: [PATCH] Allow forcing audio/video codec for VideoRoom publishers via query string --- html/videoroomtest.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/html/videoroomtest.js b/html/videoroomtest.js index c8a533c5cf..b73bd8cc57 100644 --- a/html/videoroomtest.js +++ b/html/videoroomtest.js @@ -66,6 +66,8 @@ var bitrateTimer = []; var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true"); var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true"); +var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec") : null); +var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null); var subscriber_mode = (getQueryStringValue("subscriber-mode") === "yes" || getQueryStringValue("subscriber-mode") === "true"); $(document).ready(function() { @@ -426,7 +428,12 @@ function publishOwnFeed(useAudio) { // a codec will only work if: (1) the codec is actually in the SDP (and // so the browser supports it), and (2) the codec is in the list of // allowed codecs in a room. With respect to the point (2) above, - // refer to the text in janus.plugin.videoroom.jcfg for more details + // refer to the text in janus.plugin.videoroom.jcfg for more details. + // We allow people to specify a codec via query string, for demo purposes + if(acodec) + publish["audiocodec"] = acodec; + if(vcodec) + publish["videocodec"] = vcodec; sfutest.send({ message: publish, jsep: jsep }); }, error: function(error) {