Skip to content

Chrome 92 limits the creation of MediaPlayers #1528

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

Closed
8 tasks done
arunpbk-stayqrious opened this issue Jul 23, 2021 · 18 comments
Closed
8 tasks done

Chrome 92 limits the creation of MediaPlayers #1528

arunpbk-stayqrious opened this issue Jul 23, 2021 · 18 comments
Assignees
Labels
Chrome Issues related to Chrome Group Issues related to Group Rooms

Comments

@arunpbk-stayqrious
Copy link

arunpbk-stayqrious commented Jul 23, 2021

  • I have verified that the issue occurs with the latest twilio-video.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:

Connect to a twilio room, and ask the participants to turn their video on and off for ~ 75 times (in total).

Expected behavior:

Should work as expected

Actual behavior:

Video stops playing with the error
[Intervention] Blocked attempt to create a WebMediaPlayer as there are too many WebMediaPlayers already in existence. See crbug.com/1144736#c27

Software versions:

  • Browser(s): Chrome 92
  • Operating System: Mac / Windows
  • twilio-video.js: Probably all versions
  • Third-party libraries (e.g., Angular, React, etc.): React

The culprit seems to be the allocations for dummy media elements created for tracking media track dimensions in mediatrack.js
https://github.com./twilio/twilio-video.js/blob/master/lib/media/track/mediatrack.js#L233

@charliesantos
Copy link
Collaborator

Thanks @arunpbk-stayqrious for submitting. We are currently working on this issue.

@fippo
Copy link

fippo commented Jul 26, 2021

@anna-vasilko girts got a note about this

makarandp0 added a commit that referenced this issue Jul 26, 2021
chrome 92 started [limiting](https://chromium-review.googlesource.com/c/chromium/src/+/2816118) the WebMediaPlayers. This [breaks](https://bugs.chromium.org/p/chromium/issues/detail?id=1232649) lot of webrtc applications. This fix ensures that 1) we do not leak media elements created internally and 2) we clear the `srcObject` before removing media elements.

The application that use `RemoteAudioTrack.detach`() method need to ensure that they clear srcObject on the returned elements as well.

related github issues: #1367 & #1528
@anna-vasilko anna-vasilko pinned this issue Jul 27, 2021
@anna-vasilko anna-vasilko reopened this Jul 27, 2021
@anna-vasilko anna-vasilko added Chrome Issues related to Chrome Group Issues related to Group Rooms labels Jul 27, 2021
@anna-vasilko
Copy link
Contributor

Despite the upcoming improvement in this SDK (PR #1530), the new limit of MediaPlayers in Chrome 92 may still impact group room applications where participants subscribe to many media tracks. Find more in this chrome ticket
https://bugs.chromium.org/p/chromium/issues/detail?id=1232649

@matt-hensley
Copy link

Seeing this issue with automatic track switching enabled with a handful of participants in a room.

@m-andrew-albright
Copy link

This is impacting our production system, derailing market research video chats, so we will be watching this issue closely. Please keep us updated with any new information.

(we know Chrome's update is the actual cause, not Twilio's library, so thank you for your efforts in fixing this)

@makarandp0
Copy link
Contributor

makarandp0 commented Jul 27, 2021

@matt-hensley @m-andrew-albright, We are working on a fix that would mitigate this WebMediaPlayer limit somewhat. And looks like chrome will soon be updating to increase this limit as well.
Besides these two changes we need your applications to make a small change as well. Please make sure that after detaching the media tracks in your application set srcObject to null with:

  const elements = track.detach();
  elements.forEach(el => {
    el.remove();
    el.srcObject = null;
  });

Let me know if this last change helps with your app.
Thanks,
Makarand

@m-andrew-albright
Copy link

@makarandp0 we JUST pushed our hotfix out doing exactly that -- it fixes the issue in most circumstances, but I believe when enough people manually stop/start their videos it begins to break again.

Thank you!

@tonymccallie
Copy link

@makarandp0 we tested this fix and it did not correct the issue at all. We are still getting the Blocked attempt error at 70 attaches.

@makarandp0
Copy link
Contributor

@tonymccallie, The app change (to set srcObject to null) by itself is not expected to fully resolve the issue. You do need an upcoming twilio-video sdk fix as well. I will update here once the fix is released.

@tonymccallie
Copy link

@makarandp0 is there any timeline on this code coming out? I didn't see it in 2.17.0-rc3

@BrandonMathis
Copy link

Looks like a fix for this issue was just released in version 2.15.3

@makarandp0
Copy link
Contributor

makarandp0 commented Jul 28, 2021

Thanks @BrandonMathis, Yes please try 2.15.3, This fixes the sdk side. Please note that you need the application side fix noted in the changelog as well.

Another good news is chrome is reverting the change that limited number of media player, and chrome 92 stable should get an update on Aug 3rd.

@maciejdudzinski
Copy link

@makarandp0 Can you share the source of Aug 3rd date?
Do you know if its going to be a patch release that will be downloaded automatically by browsers?

@tonymccallie
Copy link

@maciejdudzinski it looks to be from here: https://bugs.chromium.org/p/chromium/issues/detail?id=1232649#c85 Not sure about your second question.

@BrandonMathis
Copy link

BrandonMathis commented Jul 29, 2021

Heads-up, Chromium is not reverting the limit to MediaPlayer objects, they are only increasing the cap to 1000 for all devices.

Diff of change here

This will likely resolve this bug for 99.99% of scenarios but failure to properly dispose of video & audio tracks (chrome currently does not distinguish between video and audio streams) could result in this problem arising again.

Please let me know if I am mistaken but, from what I am reading, this limit is still in place but is just very very high at the moment until the chromium team implements a proper fix & publishes an article regarding best-practices when working with media streams.

another note: This issue is not Chrome only. ALL chromium-based browsers are affected including Microsoft Edge.

@ghost
Copy link

ghost commented Aug 1, 2021

I still have the same issue when updating the javascript SDK to 2.15.3 and applying the recommended code, the black screen shows after some minutes with this error.
twilio-error

@makarandp0
Copy link
Contributor

Please note that Chrome version 92.0.4515.131 is released today with the fix for MediaPlayer limit. Please update your chrome to newer version.

@makarandp0
Copy link
Contributor

closing as this is no longer applicable with chrome update - Thank you!

@anna-vasilko anna-vasilko unpinned this issue Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chrome Issues related to Chrome Group Issues related to Group Rooms
Projects
None yet
Development

No branches or pull requests

10 participants