@twilio/audioplayer
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -197,9 +197,12 @@ "use strict"; | ||
if (!this._audioElement.srcObject) { | ||
_context.next = 19; | ||
_context.next = 20; | ||
break; | ||
} | ||
this.addEventListener('ended', function () { | ||
_this2._audioElement.srcObject = null; | ||
}); | ||
return _context.abrupt("return", this._audioElement.play()); | ||
case 19: | ||
case 20: | ||
case "end": | ||
@@ -206,0 +209,0 @@ return _context.stop(); |
@@ -147,2 +147,5 @@ "use strict"; | ||
if (this._audioElement.srcObject) { | ||
this.addEventListener('ended', () => { | ||
this._audioElement.srcObject = null; | ||
}); | ||
return this._audioElement.play(); | ||
@@ -149,0 +152,0 @@ } |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
@@ -3,0 +2,0 @@ export default class EventTarget { |
{ | ||
"name": "@twilio/audioplayer", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "An HTMLAudioElement-like implementation that uses AudioContext to circumvent browser limitations.", | ||
@@ -5,0 +5,0 @@ "main": "./es5/index.js", |
@@ -227,2 +227,5 @@ import Deferred from './Deferred'; | ||
if (this._audioElement.srcObject) { | ||
this.addEventListener('ended', () => { | ||
this._audioElement.srcObject = null; | ||
}); | ||
return this._audioElement.play(); | ||
@@ -254,3 +257,2 @@ } | ||
this._sinkId = sinkId; | ||
return; | ||
@@ -257,0 +259,0 @@ } |
@@ -168,2 +168,12 @@ /* 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', () => { | ||
@@ -523,2 +533,4 @@ it('should not create another audio node', () => { | ||
srcObject: any; | ||
constructor() { | ||
@@ -525,0 +537,0 @@ this.play = sinon.spy(this.play); |
Sorry, the diff of this file is not supported yet
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
84352
1837