|
|
@@ -190,6 +190,36 @@ JitsiTrack.prototype.attach = function (container) {
|
|
190
|
190
|
return container;
|
|
191
|
191
|
};
|
|
192
|
192
|
|
|
|
193
|
+JitsiTrack.prototype.changeAudioOutput = function (audioOutputDeviceId) {
|
|
|
194
|
+ return Promise.all(this.containers.map(function(element) {
|
|
|
195
|
+ if (typeof element.setSinkId !== 'undefined') {
|
|
|
196
|
+ try {
|
|
|
197
|
+ return element.setSinkId(audioOutputDeviceId)
|
|
|
198
|
+ .then(function () {
|
|
|
199
|
+ console.log('Audio output device changed on element ' + element);
|
|
|
200
|
+ })
|
|
|
201
|
+ .catch(function (error) {
|
|
|
202
|
+ var errorMessage = error;
|
|
|
203
|
+
|
|
|
204
|
+ if (error.name === 'SecurityError') {
|
|
|
205
|
+ errorMessage = 'You need to use HTTPS for selecting audio output device: ' + error;
|
|
|
206
|
+ }
|
|
|
207
|
+
|
|
|
208
|
+ console.error('Failed to change audio output device on element ' + element + ': ' + errorMessage);
|
|
|
209
|
+
|
|
|
210
|
+ return Promise.resolve();
|
|
|
211
|
+ });
|
|
|
212
|
+ } catch(ex) {
|
|
|
213
|
+ console.error(ex);
|
|
|
214
|
+ return Promise.resolve();
|
|
|
215
|
+ }
|
|
|
216
|
+ } else {
|
|
|
217
|
+ console.warn('Browser does not support output device selection.');
|
|
|
218
|
+ return Promise.resolve();
|
|
|
219
|
+ }
|
|
|
220
|
+ }));
|
|
|
221
|
+};
|
|
|
222
|
+
|
|
193
|
223
|
/**
|
|
194
|
224
|
* Removes the track from the passed HTML container.
|
|
195
|
225
|
* @param container the HTML container. If <tt>null</tt> all containers are removed.
|