|
@@ -1315,7 +1315,7 @@ function registerListeners() {
|
1315
|
1315
|
VideoLayout.onSimulcastLayersChanging(endpointSimulcastLayers);
|
1316
|
1316
|
});
|
1317
|
1317
|
VideoLayout.init(eventEmitter);
|
1318
|
|
-
|
|
1318
|
+ AudioLevels.init();
|
1319
|
1319
|
APP.statistics.addAudioLevelListener(function(jid, audioLevel)
|
1320
|
1320
|
{
|
1321
|
1321
|
var resourceJid;
|
|
@@ -1933,6 +1933,21 @@ module.exports = UI;
|
1933
|
1933
|
},{"../../service/RTC/RTCEvents":80,"../../service/RTC/StreamEventTypes":81,"../../service/connectionquality/CQEvents":83,"../../service/desktopsharing/DesktopSharingEventTypes":84,"../../service/xmpp/XMPPEvents":86,"./audio_levels/AudioLevels.js":9,"./authentication/Authentication":11,"./avatar/Avatar":12,"./etherpad/Etherpad.js":13,"./prezi/Prezi.js":14,"./side_pannels/SidePanelToggler":16,"./side_pannels/chat/Chat.js":17,"./side_pannels/contactlist/ContactList":21,"./side_pannels/settings/Settings":22,"./side_pannels/settings/SettingsMenu":23,"./toolbars/BottomToolbar":24,"./toolbars/Toolbar":25,"./toolbars/ToolbarToggler":26,"./util/MessageHandler":28,"./util/NicknameHandler":29,"./util/UIUtil":30,"./videolayout/VideoLayout.js":32,"./welcome_page/RoomnameGenerator":33,"./welcome_page/WelcomePage":34,"events":87}],9:[function(require,module,exports){
|
1934
|
1934
|
var CanvasUtil = require("./CanvasUtils");
|
1935
|
1935
|
|
|
1936
|
+var ASDrawContext = $('#activeSpeakerAudioLevel')[0].getContext('2d');
|
|
1937
|
+
|
|
1938
|
+function initActiveSpeakerAudioLevels() {
|
|
1939
|
+ var ASRadius = interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE / 2;
|
|
1940
|
+ var ASCenter = (interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE + ASRadius) / 2;
|
|
1941
|
+
|
|
1942
|
+// Draw a circle.
|
|
1943
|
+ ASDrawContext.arc(ASCenter, ASCenter, ASRadius, 0, 2 * Math.PI);
|
|
1944
|
+
|
|
1945
|
+// Add a shadow around the circle
|
|
1946
|
+ ASDrawContext.shadowColor = interfaceConfig.SHADOW_COLOR;
|
|
1947
|
+ ASDrawContext.shadowOffsetX = 0;
|
|
1948
|
+ ASDrawContext.shadowOffsetY = 0;
|
|
1949
|
+}
|
|
1950
|
+
|
1936
|
1951
|
/**
|
1937
|
1952
|
* The audio Levels plugin.
|
1938
|
1953
|
*/
|
|
@@ -1941,6 +1956,10 @@ var AudioLevels = (function(my) {
|
1941
|
1956
|
|
1942
|
1957
|
my.LOCAL_LEVEL = 'local';
|
1943
|
1958
|
|
|
1959
|
+ my.init = function () {
|
|
1960
|
+ initActiveSpeakerAudioLevels();
|
|
1961
|
+ }
|
|
1962
|
+
|
1944
|
1963
|
/**
|
1945
|
1964
|
* Updates the audio level canvas for the given peerJid. If the canvas
|
1946
|
1965
|
* didn't exist we create it.
|
|
@@ -2027,44 +2046,26 @@ var AudioLevels = (function(my) {
|
2027
|
2046
|
}
|
2028
|
2047
|
|
2029
|
2048
|
if(resourceJid === largeVideoResourceJid) {
|
2030
|
|
- AudioLevels.updateActiveSpeakerAudioLevel(audioLevel);
|
|
2049
|
+ window.requestAnimationFrame(function () {
|
|
2050
|
+ AudioLevels.updateActiveSpeakerAudioLevel(audioLevel);
|
|
2051
|
+ });
|
2031
|
2052
|
}
|
2032
|
2053
|
};
|
2033
|
2054
|
|
2034
|
2055
|
my.updateActiveSpeakerAudioLevel = function(audioLevel) {
|
2035
|
|
- var drawContext = $('#activeSpeakerAudioLevel')[0].getContext('2d');
|
2036
|
|
- var r = interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE / 2;
|
2037
|
|
- var center = (interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE + r) / 2;
|
|
2056
|
+ if($("#activeSpeaker").css("visibility") == "hidden")
|
|
2057
|
+ return;
|
2038
|
2058
|
|
2039
|
|
- // Save the previous state of the context.
|
2040
|
|
- drawContext.save();
|
2041
|
2059
|
|
2042
|
|
- drawContext.clearRect(0, 0, 300, 300);
|
|
2060
|
+ ASDrawContext.clearRect(0, 0, 300, 300);
|
|
2061
|
+ if(audioLevel == 0)
|
|
2062
|
+ return;
|
2043
|
2063
|
|
2044
|
|
- // Draw a circle.
|
2045
|
|
- drawContext.arc(center, center, r, 0, 2 * Math.PI);
|
|
2064
|
+ ASDrawContext.shadowBlur = getShadowLevel(audioLevel);
|
2046
|
2065
|
|
2047
|
|
- // Add a shadow around the circle
|
2048
|
|
- drawContext.shadowColor = interfaceConfig.SHADOW_COLOR;
|
2049
|
|
- drawContext.shadowBlur = getShadowLevel(audioLevel);
|
2050
|
|
- drawContext.shadowOffsetX = 0;
|
2051
|
|
- drawContext.shadowOffsetY = 0;
|
2052
|
2066
|
|
2053
|
2067
|
// Fill the shape.
|
2054
|
|
- drawContext.fill();
|
2055
|
|
-
|
2056
|
|
- drawContext.save();
|
2057
|
|
-
|
2058
|
|
- drawContext.restore();
|
2059
|
|
-
|
2060
|
|
-
|
2061
|
|
- drawContext.arc(center, center, r, 0, 2 * Math.PI);
|
2062
|
|
-
|
2063
|
|
- drawContext.clip();
|
2064
|
|
- drawContext.clearRect(0, 0, 277, 200);
|
2065
|
|
-
|
2066
|
|
- // Restore the previous context state.
|
2067
|
|
- drawContext.restore();
|
|
2068
|
+ ASDrawContext.fill();
|
2068
|
2069
|
};
|
2069
|
2070
|
|
2070
|
2071
|
/**
|
|
@@ -10604,9 +10605,13 @@ PeerStats.prototype.setSsrcBitrate = function (ssrc, bitrate)
|
10604
|
10605
|
PeerStats.prototype.setSsrcAudioLevel = function (ssrc, audioLevel)
|
10605
|
10606
|
{
|
10606
|
10607
|
// Range limit 0 - 1
|
10607
|
|
- this.ssrc2AudioLevel[ssrc] = Math.min(Math.max(audioLevel, 0), 1);
|
|
10608
|
+ this.ssrc2AudioLevel[ssrc] = formatAudioLevel(audioLevel);
|
10608
|
10609
|
};
|
10609
|
10610
|
|
|
10611
|
+function formatAudioLevel(audioLevel) {
|
|
10612
|
+ return Math.min(Math.max(audioLevel, 0), 1);
|
|
10613
|
+}
|
|
10614
|
+
|
10610
|
10615
|
/**
|
10611
|
10616
|
* Array with the transport information.
|
10612
|
10617
|
* @type {Array}
|
|
@@ -10681,16 +10686,26 @@ module.exports = StatsCollector;
|
10681
|
10686
|
/**
|
10682
|
10687
|
* Stops stats updates.
|
10683
|
10688
|
*/
|
10684
|
|
-StatsCollector.prototype.stop = function ()
|
10685
|
|
-{
|
10686
|
|
- if (this.audioLevelsIntervalId)
|
10687
|
|
- {
|
|
10689
|
+StatsCollector.prototype.stop = function () {
|
|
10690
|
+ if (this.audioLevelsIntervalId) {
|
10688
|
10691
|
clearInterval(this.audioLevelsIntervalId);
|
10689
|
10692
|
this.audioLevelsIntervalId = null;
|
|
10693
|
+ }
|
|
10694
|
+
|
|
10695
|
+ if (this.statsIntervalId)
|
|
10696
|
+ {
|
10690
|
10697
|
clearInterval(this.statsIntervalId);
|
10691
|
10698
|
this.statsIntervalId = null;
|
|
10699
|
+ }
|
|
10700
|
+
|
|
10701
|
+ if(this.logStatsIntervalId)
|
|
10702
|
+ {
|
10692
|
10703
|
clearInterval(this.logStatsIntervalId);
|
10693
|
10704
|
this.logStatsIntervalId = null;
|
|
10705
|
+ }
|
|
10706
|
+
|
|
10707
|
+ if(this.gatherStatsIntervalId)
|
|
10708
|
+ {
|
10694
|
10709
|
clearInterval(this.gatherStatsIntervalId);
|
10695
|
10710
|
this.gatherStatsIntervalId = null;
|
10696
|
10711
|
}
|
|
@@ -10713,6 +10728,7 @@ StatsCollector.prototype.start = function ()
|
10713
|
10728
|
{
|
10714
|
10729
|
var self = this;
|
10715
|
10730
|
if(!config.disableAudioLevels) {
|
|
10731
|
+ console.debug("set audio levels interval");
|
10716
|
10732
|
this.audioLevelsIntervalId = setInterval(
|
10717
|
10733
|
function () {
|
10718
|
10734
|
// Interval updates
|
|
@@ -10740,6 +10756,7 @@ StatsCollector.prototype.start = function ()
|
10740
|
10756
|
}
|
10741
|
10757
|
|
10742
|
10758
|
if(!config.disableStats) {
|
|
10759
|
+ console.debug("set stats interval");
|
10743
|
10760
|
this.statsIntervalId = setInterval(
|
10744
|
10761
|
function () {
|
10745
|
10762
|
// Interval updates
|
|
@@ -11170,10 +11187,15 @@ StatsCollector.prototype.processAudioLevelReport = function ()
|
11170
|
11187
|
{
|
11171
|
11188
|
// TODO: can't find specs about what this value really is,
|
11172
|
11189
|
// but it seems to vary between 0 and around 32k.
|
11173
|
|
- audioLevel = audioLevel / 32767;
|
11174
|
|
- jidStats.setSsrcAudioLevel(ssrc, audioLevel);
|
11175
|
|
- if(jid != APP.xmpp.myJid())
|
|
11190
|
+ audioLevel = formatAudioLevel(audioLevel / 32767);
|
|
11191
|
+ var oldLevel = jidStats.ssrc2AudioLevel[ssrc];
|
|
11192
|
+ if(jid != APP.xmpp.myJid() && (!oldLevel || oldLevel != audioLevel))
|
|
11193
|
+ {
|
|
11194
|
+
|
|
11195
|
+ jidStats.ssrc2AudioLevel[ssrc] = audioLevel;
|
|
11196
|
+
|
11176
|
11197
|
this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel);
|
|
11198
|
+ }
|
11177
|
11199
|
}
|
11178
|
11200
|
|
11179
|
11201
|
}
|
|
@@ -11231,7 +11253,7 @@ function onStreamCreated(stream)
|
11231
|
11253
|
if(stream.getOriginalStream().getAudioTracks().length === 0)
|
11232
|
11254
|
return;
|
11233
|
11255
|
|
11234
|
|
- localStats = new LocalStats(stream.getOriginalStream(), 100, statistics,
|
|
11256
|
+ localStats = new LocalStats(stream.getOriginalStream(), 200, statistics,
|
11235
|
11257
|
eventEmitter);
|
11236
|
11258
|
localStats.start();
|
11237
|
11259
|
}
|