Skip to content

Commit df30724

Browse files
committed
Tweaks following review by KaptenJansson
1 parent d4315dd commit df30724

File tree

5 files changed

+10
-27
lines changed

5 files changed

+10
-27
lines changed

Diff for: src/content/peerconnection/webaudio-output/css/main.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
2+
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
33
*
44
* Use of this source code is governed by a BSD-style license
55
* that can be found in the LICENSE file in the root of the source

Diff for: src/content/peerconnection/webaudio-output/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!--
3-
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3+
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
44
*
55
* Use of this source code is governed by a BSD-style license
66
* that can be found in the LICENSE file in the root of the source

Diff for: src/content/peerconnection/webaudio-output/js/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
2+
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
33
*
44
* Use of this source code is governed by a BSD-style license
55
* that can be found in the LICENSE file in the root of the source
@@ -35,7 +35,7 @@ remoteVideo.addEventListener('loadedmetadata', function() {
3535
'px, videoHeight: ' + this.videoHeight + 'px');
3636
});
3737

38-
remoteVideo.onresize = function() {
38+
remoteVideo.addEventListener('resize', function() {
3939
trace('Remote video size changed to ' +
4040
remoteVideo.videoWidth + 'x' + remoteVideo.videoHeight);
4141
// We'll use the first onsize callback as an indication that video has started
@@ -45,7 +45,7 @@ remoteVideo.onresize = function() {
4545
trace('Setup time: ' + elapsedTime.toFixed(3) + 'ms');
4646
startTime = null;
4747
}
48-
};
48+
});
4949

5050
var localStream;
5151
var pc1;

Diff for: src/content/peerconnection/webaudio-output/js/test.js

-16
This file was deleted.

Diff for: src/content/peerconnection/webaudio-output/js/third_party/streamvisualizer.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function StreamVisualizer(remoteStream, canvas) {
2929
console.log('Creating StreamVisualizer with remoteStream and canvas: ',
3030
remoteStream, canvas);
3131
this.canvas = canvas;
32+
this.drawContext = this.canvas.getContext('2d');
3233

3334
// cope with browser differences
3435
if (typeof AudioContext === 'function') {
@@ -68,9 +69,7 @@ StreamVisualizer.prototype.draw = function() {
6869
this.analyser.getByteFrequencyData(this.freqs);
6970
this.analyser.getByteTimeDomainData(this.times);
7071

71-
// var width = Math.floor(1/this.freqs.length, 10);
7272

73-
var drawContext = this.canvas.getContext('2d');
7473
this.canvas.width = WIDTH;
7574
this.canvas.height = HEIGHT;
7675
// Draw the frequency domain chart.
@@ -81,8 +80,8 @@ StreamVisualizer.prototype.draw = function() {
8180
var offset = HEIGHT - height - 1;
8281
var barWidth = WIDTH/this.analyser.frequencyBinCount;
8382
var hue = i/this.analyser.frequencyBinCount * 360;
84-
drawContext.fillStyle = 'hsl(' + hue + ', 100%, 50%)';
85-
drawContext.fillRect(i * barWidth, offset, barWidth, height);
83+
this.drawContext.fillStyle = 'hsl(' + hue + ', 100%, 50%)';
84+
this.drawContext.fillRect(i * barWidth, offset, barWidth, height);
8685
}
8786

8887
// Draw the time domain chart.
@@ -92,8 +91,8 @@ StreamVisualizer.prototype.draw = function() {
9291
height = HEIGHT * percent;
9392
offset = HEIGHT - height - 1;
9493
barWidth = WIDTH/this.analyser.frequencyBinCount;
95-
drawContext.fillStyle = 'white';
96-
drawContext.fillRect(i * barWidth, offset, 1, 2);
94+
this.drawContext.fillStyle = 'white';
95+
this.drawContext.fillRect(i * barWidth, offset, 1, 2);
9796
}
9897

9998
requestAnimationFrame(this.draw.bind(this));

0 commit comments

Comments
 (0)