@twilio/audioplayer
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "@twilio/audioplayer", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "An HTMLAudioElement-like implementation that uses AudioContext to circumvent browser limitations.", | ||
@@ -5,0 +5,0 @@ "main": "./es5/index.js", |
@@ -123,2 +123,12 @@ import Deferred from './Deferred'; | ||
/** | ||
* The srcObject of the HTMLMediaElement | ||
*/ | ||
get srcObject(): MediaStream | MediaSource | Blob | undefined { | ||
return this._audioElement.srcObject; | ||
} | ||
set srcObject(srcObject: MediaStream | MediaSource | Blob | undefined) { | ||
this._audioElement.srcObject = srcObject; | ||
} | ||
/** | ||
* The current sinkId of the device audio is being played through. | ||
@@ -228,5 +238,2 @@ */ | ||
if (this._audioElement.srcObject) { | ||
this.addEventListener('ended', () => { | ||
this._audioElement.srcObject = null; | ||
}); | ||
return this._audioElement.play(); | ||
@@ -233,0 +240,0 @@ } |
@@ -168,12 +168,2 @@ /* tslint:disable:max-classes-per-file no-empty */ | ||
it('should clear srcObject if a sinkId is set', () => { | ||
audioPlayer.setSinkId('foo'); | ||
return audioPlayer.play().then(() => { | ||
audioContext.audioNodes[0].dispatchEvent('ended'); | ||
assert.equal(AudioFactory.instances.length, 1); | ||
assert.equal(AudioFactory.instances[0].srcObject, null); | ||
}); | ||
}); | ||
context('when already playing', () => { | ||
@@ -180,0 +170,0 @@ it('should not create another audio node', () => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84187
1835