diff --git a/src/factories/media-element-audio-source-node-constructor.ts b/src/factories/media-element-audio-source-node-constructor.ts index d3e73063..bb7712b4 100644 --- a/src/factories/media-element-audio-source-node-constructor.ts +++ b/src/factories/media-element-audio-source-node-constructor.ts @@ -4,22 +4,18 @@ import { TAudioNodeRenderer, TMediaElementAudioSourceNodeConstructorFactory, TNa export const createMediaElementAudioSourceNodeConstructor: TMediaElementAudioSourceNodeConstructorFactory = ( audioNodeConstructor, createNativeMediaElementAudioSourceNode, - getNativeContext, - isNativeOfflineAudioContext + getNativeContext ) => { - return class MediaElementAudioSourceNode extends audioNodeConstructor - implements IMediaElementAudioSourceNode { + return class MediaElementAudioSourceNode + extends audioNodeConstructor + implements IMediaElementAudioSourceNode + { private _nativeMediaElementAudioSourceNode: TNativeMediaElementAudioSourceNode; constructor(context: T, options: IMediaElementAudioSourceOptions) { const nativeContext = getNativeContext(context); const nativeMediaElementAudioSourceNode = createNativeMediaElementAudioSourceNode(nativeContext, options); - // Bug #171: Safari allows to create a MediaElementAudioSourceNode with an OfflineAudioContext. - if (isNativeOfflineAudioContext(nativeContext)) { - throw TypeError(); - } - super(context, true, nativeMediaElementAudioSourceNode, >null); this._nativeMediaElementAudioSourceNode = nativeMediaElementAudioSourceNode; diff --git a/src/factories/media-stream-audio-destination-node-constructor.ts b/src/factories/media-stream-audio-destination-node-constructor.ts index 5b472c0a..7fc70475 100644 --- a/src/factories/media-stream-audio-destination-node-constructor.ts +++ b/src/factories/media-stream-audio-destination-node-constructor.ts @@ -10,21 +10,16 @@ const DEFAULT_OPTIONS = { export const createMediaStreamAudioDestinationNodeConstructor: TMediaStreamAudioDestinationNodeConstructorFactory = ( audioNodeConstructor, createNativeMediaStreamAudioDestinationNode, - getNativeContext, - isNativeOfflineAudioContext + getNativeContext ) => { - return class MediaStreamAudioDestinationNode extends audioNodeConstructor - implements IMediaStreamAudioDestinationNode { + return class MediaStreamAudioDestinationNode + extends audioNodeConstructor + implements IMediaStreamAudioDestinationNode + { private _nativeMediaStreamAudioDestinationNode: TNativeMediaStreamAudioDestinationNode; constructor(context: T, options?: Partial) { const nativeContext = getNativeContext(context); - - // Bug #173: Safari allows to create a MediaStreamAudioDestinationNode with an OfflineAudioContext. - if (isNativeOfflineAudioContext(nativeContext)) { - throw new TypeError(); - } - const mergedOptions = { ...DEFAULT_OPTIONS, ...options }; const nativeMediaStreamAudioDestinationNode = createNativeMediaStreamAudioDestinationNode(nativeContext, mergedOptions); diff --git a/src/factories/media-stream-audio-source-node-constructor.ts b/src/factories/media-stream-audio-source-node-constructor.ts index 54411940..5f6ecab1 100644 --- a/src/factories/media-stream-audio-source-node-constructor.ts +++ b/src/factories/media-stream-audio-source-node-constructor.ts @@ -4,22 +4,18 @@ import { TAudioNodeRenderer, TMediaStreamAudioSourceNodeConstructorFactory, TNat export const createMediaStreamAudioSourceNodeConstructor: TMediaStreamAudioSourceNodeConstructorFactory = ( audioNodeConstructor, createNativeMediaStreamAudioSourceNode, - getNativeContext, - isNativeOfflineAudioContext + getNativeContext ) => { - return class MediaStreamAudioSourceNode extends audioNodeConstructor - implements IMediaStreamAudioSourceNode { + return class MediaStreamAudioSourceNode + extends audioNodeConstructor + implements IMediaStreamAudioSourceNode + { private _nativeMediaStreamAudioSourceNode: TNativeMediaStreamAudioSourceNode; constructor(context: T, options: IMediaStreamAudioSourceOptions) { const nativeContext = getNativeContext(context); const nativeMediaStreamAudioSourceNode = createNativeMediaStreamAudioSourceNode(nativeContext, options); - // Bug #172: Safari allows to create a MediaStreamAudioSourceNode with an OfflineAudioContext. - if (isNativeOfflineAudioContext(nativeContext)) { - throw new TypeError(); - } - super(context, true, nativeMediaStreamAudioSourceNode, >null); this._nativeMediaStreamAudioSourceNode = nativeMediaStreamAudioSourceNode; diff --git a/src/factories/native-media-stream-track-audio-source-node-factory.ts b/src/factories/native-media-stream-track-audio-source-node-factory.ts index 65d39dce..9b3eb537 100644 --- a/src/factories/native-media-stream-track-audio-source-node-factory.ts +++ b/src/factories/native-media-stream-track-audio-source-node-factory.ts @@ -1,8 +1,7 @@ import { TNativeMediaStreamTrackAudioSourceNodeFactoryFactory } from '../types'; export const createNativeMediaStreamTrackAudioSourceNodeFactory: TNativeMediaStreamTrackAudioSourceNodeFactoryFactory = ( - createInvalidStateError, - isNativeOfflineAudioContext + createInvalidStateError ) => { return (nativeAudioContext, { mediaStreamTrack }) => { // Bug #121: Only Firefox does yet support the MediaStreamTrackAudioSourceNode. @@ -18,11 +17,6 @@ export const createNativeMediaStreamTrackAudioSourceNodeFactory: TNativeMediaStr throw createInvalidStateError(); } - // Bug #172: Safari allows to create a MediaStreamAudioSourceNode with an OfflineAudioContext. - if (isNativeOfflineAudioContext(nativeAudioContext)) { - throw new TypeError(); - } - return nativeMediaStreamAudioSourceNode; }; }; diff --git a/src/factories/test-audio-buffer-constructor-support.ts b/src/factories/test-audio-buffer-constructor-support.ts index ef8b5c05..597ac188 100644 --- a/src/factories/test-audio-buffer-constructor-support.ts +++ b/src/factories/test-audio-buffer-constructor-support.ts @@ -60,6 +60,12 @@ import { TTestAudioBufferConstructorSupportFactory } from '../types'; * * Bug #169: Safari up to version 13.1 threw an error on each attempt to change the channelCount of an AudioDestinationNode. * + * Bug #171: Safari up to version 13.1 allowed to create a MediaElementAudioSourceNode with an OfflineAudioContext. + * + * Bug #172: Safari up to version 13.1 allowed to create a MediaStreamAudioSourceNode with an OfflineAudioContext. + * + * Bug #173: Safari up to version 13.1 allowed to create a MediaStreamAudioDestinationNode with an OfflineAudioContext. + * * Bug #180: Safari up to version 13.1 not allowed to use ordinary arrays as parameters of createPeriodicWave(). */ export const createTestAudioBufferConstructorSupport: TTestAudioBufferConstructorSupportFactory = (nativeAudioBufferConstructor) => { diff --git a/src/module.ts b/src/module.ts index e6f1090b..ffb4f714 100644 --- a/src/module.ts +++ b/src/module.ts @@ -805,8 +805,7 @@ const baseAudioContextConstructor = createBaseAudioContextConstructor( const mediaElementAudioSourceNodeConstructor: TMediaElementAudioSourceNodeConstructor = createMediaElementAudioSourceNodeConstructor( audioNodeConstructor, createNativeMediaElementAudioSourceNode, - getNativeContext, - isNativeOfflineAudioContext + getNativeContext ); const mediaStreamAudioDestinationNodeConstructor: TMediaStreamAudioDestinationNodeConstructor = createMediaStreamAudioDestinationNodeConstructor( diff --git a/src/types/media-element-audio-source-node-constructor-factory.ts b/src/types/media-element-audio-source-node-constructor-factory.ts index edede0d9..c16cf270 100644 --- a/src/types/media-element-audio-source-node-constructor-factory.ts +++ b/src/types/media-element-audio-source-node-constructor-factory.ts @@ -1,12 +1,10 @@ import { TAudioNodeConstructor } from './audio-node-constructor'; import { TGetNativeContextFunction } from './get-native-context-function'; -import { TIsNativeOfflineAudioContextFunction } from './is-native-offline-audio-context-function'; import { TMediaElementAudioSourceNodeConstructor } from './media-element-audio-source-node-constructor'; import { TNativeMediaElementAudioSourceNodeFactory } from './native-media-element-audio-source-node-factory'; export type TMediaElementAudioSourceNodeConstructorFactory = ( audioNodeConstructor: TAudioNodeConstructor, createNativeMediaElementAudioSourceNode: TNativeMediaElementAudioSourceNodeFactory, - getNativeContext: TGetNativeContextFunction, - isNativeOfflineAudioContext: TIsNativeOfflineAudioContextFunction + getNativeContext: TGetNativeContextFunction ) => TMediaElementAudioSourceNodeConstructor; diff --git a/src/types/media-stream-audio-source-node-constructor-factory.ts b/src/types/media-stream-audio-source-node-constructor-factory.ts index 56907962..3e37d1e2 100644 --- a/src/types/media-stream-audio-source-node-constructor-factory.ts +++ b/src/types/media-stream-audio-source-node-constructor-factory.ts @@ -1,12 +1,10 @@ import { TAudioNodeConstructor } from './audio-node-constructor'; import { TGetNativeContextFunction } from './get-native-context-function'; -import { TIsNativeOfflineAudioContextFunction } from './is-native-offline-audio-context-function'; import { TMediaStreamAudioSourceNodeConstructor } from './media-stream-audio-source-node-constructor'; import { TNativeMediaStreamAudioSourceNodeFactory } from './native-media-stream-audio-source-node-factory'; export type TMediaStreamAudioSourceNodeConstructorFactory = ( audioNodeConstructor: TAudioNodeConstructor, createNativeMediaStreamAudioSourceNode: TNativeMediaStreamAudioSourceNodeFactory, - getNativeContext: TGetNativeContextFunction, - isNativeOfflineAudioContext: TIsNativeOfflineAudioContextFunction + getNativeContext: TGetNativeContextFunction ) => TMediaStreamAudioSourceNodeConstructor; diff --git a/src/types/native-media-stream-track-audio-source-node-factory-factory.ts b/src/types/native-media-stream-track-audio-source-node-factory-factory.ts index d488bf1e..806e24f8 100644 --- a/src/types/native-media-stream-track-audio-source-node-factory-factory.ts +++ b/src/types/native-media-stream-track-audio-source-node-factory-factory.ts @@ -1,8 +1,6 @@ import { TInvalidStateErrorFactory } from './invalid-state-error-factory'; -import { TIsNativeOfflineAudioContextFunction } from './is-native-offline-audio-context-function'; import { TNativeMediaStreamTrackAudioSourceNodeFactory } from './native-media-stream-track-audio-source-node-factory'; export type TNativeMediaStreamTrackAudioSourceNodeFactoryFactory = ( - createInvalidStateError: TInvalidStateErrorFactory, - isNativeOfflineAudioContext: TIsNativeOfflineAudioContextFunction + createInvalidStateError: TInvalidStateErrorFactory ) => TNativeMediaStreamTrackAudioSourceNodeFactory; diff --git a/test/expectation/safari/legacy/offline-audio-context-constructor.js b/test/expectation/safari/legacy/offline-audio-context-constructor.js index b2315cc5..afa2808b 100644 --- a/test/expectation/safari/legacy/offline-audio-context-constructor.js +++ b/test/expectation/safari/legacy/offline-audio-context-constructor.js @@ -380,38 +380,6 @@ describe('offlineAudioContextConstructor', () => { }); }); - describe('createMediaElementSource()', () => { - // bug #171 - - it('should not throw an error', () => { - offlineAudioContext.createMediaElementSource(new Audio()); - }); - }); - - describe('createMediaStreamDestination()', () => { - // bug #173 - - it('should not throw an error', () => { - offlineAudioContext.createMediaStreamDestination(); - }); - }); - - describe('createMediaStreamSource()', () => { - let audioContext; - - afterEach(() => audioContext.close()); - - beforeEach(() => (audioContext = new webkitAudioContext())); // eslint-disable-line new-cap, no-undef - - // bug #172 - - it('should not throw an error', () => { - const mediaStreamAudioDestinationNode = audioContext.createMediaStreamDestination(); - - offlineAudioContext.createMediaStreamSource(mediaStreamAudioDestinationNode.stream); - }); - }); - describe('createScriptProcessor()', () => { // bug #8