|
@@ -42,19 +42,8 @@ class AudioOutputPreview extends Component<Props> {
|
42
|
42
|
|
43
|
43
|
this._audioElement = null;
|
44
|
44
|
|
|
45
|
+ this._audioElementReady = this._audioElementReady.bind(this);
|
45
|
46
|
this._onClick = this._onClick.bind(this);
|
46
|
|
- this._setAudioElement = this._setAudioElement.bind(this);
|
47
|
|
- }
|
48
|
|
-
|
49
|
|
- /**
|
50
|
|
- * Sets the target output device on the component's audio element after
|
51
|
|
- * initial render.
|
52
|
|
- *
|
53
|
|
- * @inheritdoc
|
54
|
|
- * @returns {void}
|
55
|
|
- */
|
56
|
|
- componentDidMount() {
|
57
|
|
- this._setAudioSink();
|
58
|
47
|
}
|
59
|
48
|
|
60
|
49
|
/**
|
|
@@ -81,37 +70,39 @@ class AudioOutputPreview extends Component<Props> {
|
81
|
70
|
{ this.props.t('deviceSelection.testAudio') }
|
82
|
71
|
</a>
|
83
|
72
|
<Audio
|
84
|
|
- setRef = { this._setAudioElement }
|
|
73
|
+ setRef = { this._audioElementReady }
|
85
|
74
|
src = { TEST_SOUND_PATH } />
|
86
|
75
|
</div>
|
87
|
76
|
);
|
88
|
77
|
}
|
89
|
78
|
|
90
|
|
- _onClick: () => void;
|
|
79
|
+ _audioElementReady: (Object) => void;
|
91
|
80
|
|
92
|
81
|
/**
|
93
|
|
- * Plays a test sound.
|
|
82
|
+ * Sets the instance variable for the component's audio element so it can be
|
|
83
|
+ * accessed directly.
|
94
|
84
|
*
|
|
85
|
+ * @param {Object} element - The DOM element for the component's audio.
|
95
|
86
|
* @private
|
96
|
87
|
* @returns {void}
|
97
|
88
|
*/
|
98
|
|
- _onClick() {
|
99
|
|
- this._audioElement
|
100
|
|
- && this._audioElement.play();
|
|
89
|
+ _audioElementReady(element: Object) {
|
|
90
|
+ this._audioElement = element;
|
|
91
|
+
|
|
92
|
+ this._setAudioSink();
|
101
|
93
|
}
|
102
|
94
|
|
103
|
|
- _setAudioElement: (Object) => void;
|
|
95
|
+ _onClick: () => void;
|
104
|
96
|
|
105
|
97
|
/**
|
106
|
|
- * Sets the instance variable for the component's audio element so it can be
|
107
|
|
- * accessed directly.
|
|
98
|
+ * Plays a test sound.
|
108
|
99
|
*
|
109
|
|
- * @param {Object} element - The DOM element for the component's audio.
|
110
|
100
|
* @private
|
111
|
101
|
* @returns {void}
|
112
|
102
|
*/
|
113
|
|
- _setAudioElement(element: Object) {
|
114
|
|
- this._audioElement = element;
|
|
103
|
+ _onClick() {
|
|
104
|
+ this._audioElement
|
|
105
|
+ && this._audioElement.play();
|
115
|
106
|
}
|
116
|
107
|
|
117
|
108
|
/**
|
|
@@ -122,7 +113,7 @@ class AudioOutputPreview extends Component<Props> {
|
122
|
113
|
*/
|
123
|
114
|
_setAudioSink() {
|
124
|
115
|
this._audioElement
|
125
|
|
- && this._audioElement.setSinkId(this.props.deviceId);
|
|
116
|
+ && this._audioElement.setSinkId(this.props.deviceId);
|
126
|
117
|
}
|
127
|
118
|
}
|
128
|
119
|
|