Skip to content

Commit faf27d0

Browse files
committed
fixing cross-origin audio bugs for tests
1 parent 908069b commit faf27d0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test/resources/offline_test_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports = function (app, log) {
6969
]
7070
}
7171
]
72-
}))
72+
}));
7373
}
7474
}, 700);
7575
}

test/spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ describe("WatsonSpeechToText", function() {
3737

3838
// not sure why, but I can't convince firefox or chrome to actually play <audio> elements during tests
3939
// also, on travis, the element never appears to stop playing (or, more likely, it nevers starts in the first place)
40-
(offline && !travis ? it : xit)('should transcribe <audio> elements', function(done) {
40+
it('should transcribe <audio> elements', function(done) {
4141
getConfig().then(function(cfg) {
4242
var audioElement = new Audio();
43+
audioElement.crossOrigin = true;
4344
audioElement.src = "http://localhost:9877/audio.wav";
4445
cfg.element = audioElement;
46+
cfg.muteSource = true;
4547
var stream = WatsonSpeechToText.recognizeElement(cfg);
4648
//stream.on('send-json', console.log.bind(console, 'sending'));
4749
//stream.on('message', console.log.bind(console, 'received'));

0 commit comments

Comments
 (0)