Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser requests song url every time you skip to a new location in the song #478

Open
sbrattla opened this issue Mar 3, 2022 · 0 comments
Assignees
Labels
Bug: Needs Confirmation 🧐 Bugs that are reported, but needs to be confirmed and replicated.

Comments

@sbrattla
Copy link

sbrattla commented Mar 3, 2022

Issue description

When you Amplitude.skipTo() to a new location for the currently playing audio, a request is being made for the URL of the audio. This happens every time you skip to a new location in the currently loaded / playing audio.

Environment

  • Amplitude.js Version: 5.3.0

Steps to reproduce the issue

  1. Load a song with Amplitude.addSong({url: [url]});
  2. Skip to a new location with Amplitude.skipTo(5, 0)

Every time you skip to a new location, a new request is being made by the browser for the song url.

What is expected?

I would expect a request not to be made as long as you skip within the already loaded song.

Additional details / screenshots

I can see that this happens in audioNavigation.js and it's changeSong() function. By setting config.audio.src = song.url every time a skip to a new location is done, this triggers the browser to request the song url again.

By wrapping this section in a check to validate if the song url is the same, the request is avoided :

    /*
      Change the song if the song.url is different from the current audio.src.
    */
    if (_config2.default.audio.src !== song.url) {
      _config2.default.audio.src = song.url;
      _config2.default.active_metadata = song;
      _config2.default.active_album = song.album;
    }
@sbrattla sbrattla added the Bug: Needs Confirmation 🧐 Bugs that are reported, but needs to be confirmed and replicated. label Mar 3, 2022
@danpastori danpastori self-assigned this May 4, 2022
@danpastori danpastori moved this to Being Documented in AmplitudeJS 6.0 May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Needs Confirmation 🧐 Bugs that are reported, but needs to be confirmed and replicated.
Projects
Status: Being Documented
Development

No branches or pull requests

2 participants