Skip to content

Commit

Permalink
fix: resolve issue when trying to play a sound that is already playing.
Browse files Browse the repository at this point in the history
fixes #23
  • Loading branch information
jkeen committed Nov 12, 2023
1 parent cbca121 commit dc32ba3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addon/services/stereo.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,12 @@ export default class Stereo extends Service.extend(EmberEvented) {
options = { metadata: {}, ...options };

let previouslyPlayingSound = this.isPlaying ? this.currentSound : false;
if (
previouslyPlayingSound &&
previouslyPlayingSound?.urlsAreEqual(urlsOrPromise)
) {
return { sound: previouslyPlayingSound, failures: [] };
}

let loadPromise = this.loadTask.perform(urlsOrPromise, options);
this.trigger('new-load-request', { loadPromise, urlsOrPromise, options }); //urls: Promise.resolve(resolveUrls(urlsOrPromise))
Expand Down

0 comments on commit dc32ba3

Please sign in to comment.