diff --git a/packages/common/src/dotlottie-player.ts b/packages/common/src/dotlottie-player.ts index a163b21c..213543d8 100644 --- a/packages/common/src/dotlottie-player.ts +++ b/packages/common/src/dotlottie-player.ts @@ -1751,6 +1751,8 @@ export class DotLottiePlayer { loop, })); + let audioFactory; + if (this._animation && lottieContainsAudio(this._animation)) { if (this._howlerInstance) { this._howlerInstance.unload(); @@ -1764,14 +1766,23 @@ export class DotLottiePlayer { return this._howlerInstance; }; - options['audioFactory'] = howl; + audioFactory = howl; } - this._lottie = lottiePlayer.loadAnimation({ - ...options, - container: this._container as Element, - animationData: this._animation, - }); + if (audioFactory) { + this._lottie = lottiePlayer.loadAnimation({ + ...options, + container: this._container as Element, + animationData: this._animation, + audioFactory, + }); + } else { + this._lottie = lottiePlayer.loadAnimation({ + ...options, + container: this._container as Element, + animationData: this._animation, + }); + } this.addEventListeners();