mirror of
https://github.com/eliasstepanik/vdo.ninja.git
synced 2026-01-11 13:48:38 +00:00
more advanced audio options/stats
This commit is contained in:
parent
a19f91597f
commit
6422754e88
@ -81,9 +81,9 @@
|
||||
<span itemprop="thumbnail" itemscope itemtype="http://schema.org/ImageObject">
|
||||
<link itemprop="url" href="./media/vdoNinja_logo_full.png" />
|
||||
</span>
|
||||
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/CodecsHandler.js?ver=41"></script>
|
||||
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/CodecsHandler.js?ver=43"></script>
|
||||
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/aes.js"></script>
|
||||
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=543"></script>
|
||||
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=544"></script>
|
||||
<input id="zoomSlider" type="range" style="display: none;" />
|
||||
<span id="electronDragZone" style="pointer-events: none; z-index:-10; position:absolute;top:0;left:0;width:100%;height:2%;-webkit-app-region: drag;min-height:20px;"></span>
|
||||
<div id="header">
|
||||
@ -2292,11 +2292,11 @@
|
||||
// session.defaultBackgroundImages = ["./media/bg_sample1.webp", "./media/bg_sample2.webp"]; // for &effects=5 (virtual backgrounds)
|
||||
// session.hidehome = true; // If used, 'hide home' will make the landing page inaccessible, along with hiding a few go-home elements.
|
||||
</script>
|
||||
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=552"></script>
|
||||
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=554"></script>
|
||||
<!--
|
||||
// If you wish to change branding, blank offers a good clean start.
|
||||
<script type="text/javascript" id="main-js" src="./main.js" data-translation="blank"></script>
|
||||
-->
|
||||
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=484"></script>
|
||||
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=485"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
46
lib.js
46
lib.js
@ -3095,6 +3095,9 @@ function updateMixer(e=false){
|
||||
}
|
||||
updateMixerActive=true;
|
||||
log("updating mixer");
|
||||
|
||||
//console.log((new Error()).stack); // useful for breakpoints; finding what called updateMixer.
|
||||
|
||||
try{
|
||||
updateMixerRun(e);
|
||||
// clearInterval(cleanupTimeout);
|
||||
@ -7856,10 +7859,12 @@ function processStats(UUID){
|
||||
session.rpcs[UUID].stats[trackID]._last_bytes = stat.bytesReceived || session.rpcs[UUID].stats[trackID]._last_bytes;
|
||||
session.rpcs[UUID].stats[trackID]._last_time = stat.timestamp || session.rpcs[UUID].stats[trackID]._last_time;
|
||||
|
||||
session.rpcs[UUID].stats._codecId = stat.codecId;
|
||||
session.rpcs[UUID].stats._codecIdTrackId = trackID;
|
||||
|
||||
if (stat.mediaType=="video"){
|
||||
|
||||
session.rpcs[UUID].stats._codecId = stat.codecId;
|
||||
session.rpcs[UUID].stats._codecIdTrackId = trackID;
|
||||
|
||||
session.rpcs[UUID].stats[trackID].type = "Video Stream"
|
||||
session.rpcs[UUID].stats[trackID]._type = "video";
|
||||
if ((session.obsfix) && ("codec" in session.rpcs[UUID].stats) && (session.rpcs[UUID].stats.codec=="video/VP8")){
|
||||
@ -7910,10 +7915,10 @@ function processStats(UUID){
|
||||
session.rpcs[UUID].stats[trackID]._timestamp = stat.timestamp/1000;
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else if (stat.mediaType=="audio"){
|
||||
//log("AUDIO LEVEL: "+stat.audioLevel);
|
||||
session.rpcs[UUID].stats._audioCodecId = stat.codecId;
|
||||
session.rpcs[UUID].stats._audioCodecIdTrackId = trackID;
|
||||
session.rpcs[UUID].stats[trackID].type = "Audio Stream";
|
||||
session.rpcs[UUID].stats[trackID]._type = "audio";
|
||||
if ("audioLevel" in stat){
|
||||
@ -7967,12 +7972,33 @@ function processStats(UUID){
|
||||
session.rpcs[UUID].stats[session.rpcs[UUID].stats._codecIdTrackId] = {};
|
||||
session.rpcs[UUID].stats[session.rpcs[UUID].stats._codecIdTrackId].codec = stat.mimeType;
|
||||
}
|
||||
|
||||
}
|
||||
if ("frameHeight" in stat){
|
||||
if ("frameWidth" in stat){
|
||||
session.rpcs[UUID].stats.Resolution = parseInt(stat.frameWidth)+" x "+parseInt(stat.frameHeight);
|
||||
}
|
||||
}
|
||||
} else if (("_audioCodecId" in session.rpcs[UUID].stats) && (stat.id == session.rpcs[UUID].stats._audioCodecId)){
|
||||
|
||||
if ("mimeType" in stat){
|
||||
var addOnDescription = stat.mimeType;
|
||||
addOnDescription = addOnDescription.replace("audio/", "");
|
||||
|
||||
if ("sdpFmtpLine" in stat){
|
||||
if (stat.sdpFmtpLine.includes("useinbandfec=1")){
|
||||
addOnDescription += ", /w fec";
|
||||
}
|
||||
}
|
||||
|
||||
if (session.rpcs[UUID].stats[session.rpcs[UUID].stats._audioCodecIdTrackId]){
|
||||
} else {
|
||||
session.rpcs[UUID].stats[session.rpcs[UUID].stats._audioCodecIdTrackId] = {};
|
||||
}
|
||||
session.rpcs[UUID].stats[session.rpcs[UUID].stats._audioCodecIdTrackId].codec = addOnDescription;
|
||||
session.rpcs[UUID].stats[session.rpcs[UUID].stats._audioCodecIdTrackId]
|
||||
|
||||
}
|
||||
} else if (Firefox){
|
||||
if ("frameWidth" in stat){
|
||||
session.rpcs[UUID].stats.resolution = stat.frameWidth +" x " + stat.frameHeight;
|
||||
@ -8098,10 +8124,12 @@ function playoutdelay(UUID){ // applies a delay to all videos
|
||||
if (session.rpcs[UUID].stats[tid]._type=="audio"){
|
||||
if (sync_offset<0){sync_offset=0;}
|
||||
session.rpcs[UUID].stats[tid]._sync_offset = sync_offset;
|
||||
|
||||
receiver.playoutDelayHint = parseFloat(sync_offset/1000);
|
||||
// receiver.jitterBufferDelayhint = parseFloat(sync_offset/1000); // This is deprecated I believe
|
||||
|
||||
if (session.sync!==false){
|
||||
var audio_delay = session.sync || 0; // video is typically showing greater delay than video
|
||||
var audio_delay = session.sync || 0; // video is typically showing greater delay than audio.
|
||||
audio_delay += target_buffer - session.rpcs[UUID].stats[tid].Buffer_Delay_in_ms
|
||||
if (receiver.track.id in session.rpcs[UUID].inboundAudioPipeline){
|
||||
if (session.rpcs[UUID].inboundAudioPipeline[receiver.track.id] && session.rpcs[UUID].inboundAudioPipeline[receiver.track.id].delayNode){
|
||||
@ -8118,7 +8146,8 @@ function playoutdelay(UUID){ // applies a delay to all videos
|
||||
} else if (session.rpcs[UUID].stats[tid]._type=="video"){
|
||||
if(sync_offset<0){sync_offset=0;}
|
||||
session.rpcs[UUID].stats[tid]._sync_offset = sync_offset;
|
||||
receiver.playoutDelayHint = parseFloat(sync_offset/1000); // only the video we are going to do the playout delay for; doesn't work well with audio.
|
||||
receiver.playoutDelayHint = parseFloat(sync_offset/1000); // Chrome seems to somewhat sync audio and video when using the delay
|
||||
// receiver.jitterBufferDelayhint = parseFloat(sync_offset/1000); // This is deprecated I believe
|
||||
}
|
||||
|
||||
}
|
||||
@ -18768,7 +18797,10 @@ async function grabVideo(quality = 0, eleName = 'previewWebcam', selector = "sel
|
||||
updateForceRotate();
|
||||
|
||||
if (iOS || iPad){
|
||||
updateMixer(); // if we don't do this, portrait videos may be detected as horizontal
|
||||
// if we don't do this, portrait videos may be detected as horizontal
|
||||
if (!document.getElementById("previewWebcam")){
|
||||
updateMixer(); // not with the preview, but after.
|
||||
}
|
||||
}
|
||||
|
||||
// this will reset scaling for all viewers of this stream. I also call it when aspect ratio, width, or height is changed via applyConstraints
|
||||
|
||||
20
main.js
20
main.js
@ -110,6 +110,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
|
||||
|
||||
if (urlParams.has('director') || urlParams.has('dir')) {
|
||||
session.director = urlParams.get('director') || urlParams.get('dir') || true;
|
||||
session.effect = null; // so the director can see the effects after a page refresh
|
||||
}
|
||||
|
||||
if (urlParams.has('controls') || urlParams.has('videocontrols')) {
|
||||
@ -2264,8 +2265,16 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
|
||||
session.screensharecursor = true;
|
||||
}
|
||||
|
||||
|
||||
if (urlParams.has('dtx') || urlParams.has('usedtx')) {
|
||||
session.dtx = true;
|
||||
session.cbr = 0; // no point dtx on if cbr is on, right?
|
||||
}
|
||||
|
||||
if (urlParams.has('vbr')) {
|
||||
session.cbr = 0;
|
||||
} else if (urlParams.has('cbr')) {
|
||||
session.cbr = 1;
|
||||
}
|
||||
|
||||
if (urlParams.has('order')) {
|
||||
@ -2372,6 +2381,14 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
|
||||
warnlog("Defaulting to VP8 manually, as H264 with remote iOS devices is not supported");
|
||||
}
|
||||
|
||||
if (urlParams.has('audiocodec')) {
|
||||
log("CODEC CHANGED");
|
||||
session.audioCodec = urlParams.get('audiocodec') || false;
|
||||
if (session.audioCodec){
|
||||
session.audioCodec = session.audioCodec.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
if (urlParams.has('scenelinkcodec')){ // this is mainly for a niche iframe API use
|
||||
log("codecGroupFlag CHANGED");
|
||||
session.codecGroupFlag = urlParams.get('scenelinkcodec') || false;
|
||||
@ -2405,6 +2422,9 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
|
||||
}
|
||||
}
|
||||
|
||||
if (urlParams.has('nofec')){ // disables error control / throttling -- currently on audio
|
||||
session.noFEC = true;
|
||||
}
|
||||
if (urlParams.has('nonacks')){ // disables error control / throttling.
|
||||
session.noNacks = true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user