Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
907ace2
commit f19e460
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* @since 4.2.0 | ||
*/ | ||
|
||
import TestHelpers from '../test-helpers'; | ||
|
||
import Event from '../../src/js/event'; | ||
|
||
// registers the plugin | ||
import OpusMediaRecorderEngine from '../../src/js/plugins/opus-media-recorder-plugin'; | ||
import {OPUSMEDIARECORDER} from '../../src/js/engine/record-engine'; | ||
|
||
|
||
/** @test {OpusMediaRecorderEngine} */ | ||
describe('plugins.opus-media-recorder-plugin', () => { | ||
let player; | ||
|
||
afterEach(() => { | ||
player.dispose(); | ||
}); | ||
|
||
/** @test {OpusMediaRecorderEngine} */ | ||
it('can run as an audio-only plugin', (done) => { | ||
// create audio-only player with opus-media-recorder plugin | ||
player = TestHelpers.makeAudioOnlyPluginPlayer(OPUSMEDIARECORDER); | ||
|
||
player.one(Event.FINISH_RECORD, () => { | ||
// received a blob file | ||
expect(player.recordedData instanceof Blob).toBeTruthy(); | ||
expect(player.recordedData.name).toEndWith('.oga'); | ||
|
||
// wait till it's loaded before destroying | ||
// (XXX: create new event for this) | ||
setTimeout(done, 1000); | ||
}); | ||
|
||
player.one(Event.START_RECORD, () => { | ||
// stop recording after few seconds | ||
setTimeout(() => { | ||
player.record().stop(); | ||
}, 2000); | ||
}); | ||
|
||
player.one(Event.DEVICE_READY, () => { | ||
// record some audio | ||
player.record().start(); | ||
}); | ||
|
||
player.one(Event.READY, () => { | ||
// start device | ||
player.record().getDevice(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters