Skip to content

Commit

Permalink
Fix Record#setAudioOutput for non Audio only players
Browse files Browse the repository at this point in the history
  • Loading branch information
restless committed Sep 27, 2024
1 parent 1285cec commit 0dfa5f9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/videojs.record.js
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ class Record extends Plugin {
break;

default:
let element = player.tech_.el_;
let element = this.player.tech_.el_;
if (deviceId) {
if (typeof element.sinkId !== 'undefined') {
element.setSinkId(deviceId).then((result) => {
Expand Down
21 changes: 21 additions & 0 deletions test/videojs.record.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,27 @@ describe('Record', () => {
});
});

/** @test {Record#setAudioOutput} */
it('can set audio output for video player', (done) => {
// create new audio-video player
let player = TestHelpers.makeAudioVideoPlayer();

player.one(Event.ERROR, (e) => {
expect(e.type).toEqual(Event.ERROR);

done();
});

player.one(Event.ENUMERATE_READY, () => {
player.record().setAudioOutput('fakeId');
});

player.one(Event.READY, () => {
player.record().enumerateDevices();
});
});


/** @test {Record#saveAs} */
it('saves as', (done) => {
// create new player
Expand Down

0 comments on commit 0dfa5f9

Please sign in to comment.