File tree Expand file tree Collapse file tree 3 files changed +69
-0
lines changed
Expand file tree Collapse file tree 3 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ describe ( 'MediaStreamAudioSourceNode' , ( ) => {
2+ let mediaStreamAudioDestinationNode ;
3+
4+ afterEach ( ( ) => mediaStreamAudioDestinationNode . context . close ( ) ) ;
5+
6+ beforeEach ( ( ) => {
7+ mediaStreamAudioDestinationNode = new MediaStreamAudioDestinationNode ( new AudioContext ( ) ) ;
8+ } ) ;
9+
10+ // bug #212
11+
12+ it ( 'should not allow using a stream with a different sampleRate' , async ( ) => {
13+ const audioContext = new AudioContext ( { sampleRate : mediaStreamAudioDestinationNode . context . sampleRate === 44100 ? 48000 : 44100 } ) ;
14+
15+ try {
16+ expect ( ( ) => new MediaStreamAudioSourceNode ( audioContext , { mediaStream : mediaStreamAudioDestinationNode . stream } ) )
17+ . to . throw ( DOMException )
18+ . to . include ( { code : 9 , name : 'NotSupportedError' } ) ;
19+ } finally {
20+ await audioContext . close ( ) ;
21+ }
22+ } ) ;
23+ } ) ;
Original file line number Diff line number Diff line change 1+ describe ( 'MediaStreamAudioSourceNode' , ( ) => {
2+ let mediaStreamAudioDestinationNode ;
3+
4+ afterEach ( ( ) => mediaStreamAudioDestinationNode . context . close ( ) ) ;
5+
6+ beforeEach ( ( ) => {
7+ mediaStreamAudioDestinationNode = new MediaStreamAudioDestinationNode ( new AudioContext ( ) ) ;
8+ } ) ;
9+
10+ // bug #212
11+
12+ it ( 'should not allow using a stream with a different sampleRate' , async ( ) => {
13+ const audioContext = new AudioContext ( { sampleRate : mediaStreamAudioDestinationNode . context . sampleRate === 44100 ? 48000 : 44100 } ) ;
14+
15+ try {
16+ expect ( ( ) => new MediaStreamAudioSourceNode ( audioContext , { mediaStream : mediaStreamAudioDestinationNode . stream } ) )
17+ . to . throw ( DOMException )
18+ . to . include ( { code : 9 , name : 'NotSupportedError' } ) ;
19+ } finally {
20+ await audioContext . close ( ) ;
21+ }
22+ } ) ;
23+ } ) ;
Original file line number Diff line number Diff line change 1+ describe ( 'MediaStreamAudioSourceNode' , ( ) => {
2+ let mediaStreamAudioDestinationNode ;
3+
4+ afterEach ( ( ) => mediaStreamAudioDestinationNode . context . close ( ) ) ;
5+
6+ beforeEach ( ( ) => {
7+ mediaStreamAudioDestinationNode = new MediaStreamAudioDestinationNode ( new AudioContext ( ) ) ;
8+ } ) ;
9+
10+ // bug #212
11+
12+ it ( 'should not allow using a stream with a different sampleRate' , async ( ) => {
13+ const audioContext = new AudioContext ( { sampleRate : mediaStreamAudioDestinationNode . context . sampleRate === 44100 ? 48000 : 44100 } ) ;
14+
15+ try {
16+ expect ( ( ) => new MediaStreamAudioSourceNode ( audioContext , { mediaStream : mediaStreamAudioDestinationNode . stream } ) )
17+ . to . throw ( DOMException )
18+ . to . include ( { code : 9 , name : 'NotSupportedError' } ) ;
19+ } finally {
20+ await audioContext . close ( ) ;
21+ }
22+ } ) ;
23+ } ) ;
You can’t perform that action at this time.
0 commit comments