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

[BUG] The play() request was interrupted by a call to pause(). #297

Open
3 of 4 tasks
jscheid opened this issue Jan 5, 2022 · 0 comments
Open
3 of 4 tasks

[BUG] The play() request was interrupted by a call to pause(). #297

jscheid opened this issue Jan 5, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@jscheid
Copy link

jscheid commented Jan 5, 2022

  • I have verified that the issue occurs with the latest twilio.js release and is not marked as a known issue in the CHANGELOG.md.
  • I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
  • I verified that the Quickstart application works in my environment.
  • I am not sharing any Personally Identifiable Information (PII)
    or sensitive account information (API keys, credentials, etc.) when reporting this issue.

Code to reproduce the issue:

N/A

Expected behavior:

N/A

Actual behavior:

We're seeing the following error sporadically when a call is being established:
The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22.

This error is triggered by a race condition and therefore difficult to reproduce. However, looking at the code in https://github.com/twilio/twilio-client.js/blob/master/lib/twilio/sound.js the client does not always ensure that pause is called only after the promise returned by play has resolved, as described in the link contained in the error message. The following sequence of events can cause it to be called prematurely:

  1. _play is called. It assigns a promise to _playPromise without waiting for the promise to resolve.
  2. _play is called again before _playPromise resolves. isPlaying returns true because _playPromise is present.
  3. This causes the condition at the very start of _play to be true, and therefore _stop to be called, which in turn calls pause on the audio element.

In short, the guard at the beginning of _play causes pause to be called on the audio element if playback has been initiated, but without checking that playback has commenced, which is a race condition in current Chrome versions as described in the linked page.

Software versions:

Last seen on Chrome 96.0.4664 on Windows 10 with twilio-client 1.13.0

@jscheid jscheid added the bug Something isn't working label Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant