You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chrome 92 has introduced a limit on the number of audio tags that can be allocated per tab. 75 for desktop, 40 for mobile. This causes issues when playing a lot of audio files, since currently the AudioElements are not removed after playing.
Full Description
AudioPlayers currently does not remove created AudioElements from the DOM. This obviously leads to issues when the browser has a hard limit of the number of AudioElements that can be active at once. Even calling setUrl(String url) will cause the issue to pop up eventually, since a new AudioElement is created every time.
I've added a workaround that seems to fix the issue, but I'm not sure this would be the best way to solve it.
In audioplayers_web.dart change release() and start(double position) to the following
voidrelease() {
player?.src ='';
player?.remove();
_cancel();
player =null;
}
voidstart(double position) {
isPlaying =true;
if (currentUrl ==null) {
return; // nothing to play yet
}
if (player ==null) {
recreateNode();
}
player?.play();
player?.currentTime = position;
player?.onEnded.listen((event) {
release();
});
}
player?.src = ''; is important, since only calling player?.remove() won't properly destroy the AudioElement.
Code to Reproduce
Easiest way to reproduce is ofcourse to create an app with the latest AudioPlayers (0.19.1), and play a lot of audio using any of the available methods. Personally I'm using AudioCache but as a quick test I'm sure you could do something like
for(int i =0; i <100; i++) {
AudioPlayer().play('assets/audio/sound.mp3');
}
Log Errors
App error:
NotSupportedError: Failed to load because no supported source was found.
Browser error:
[Intervention] Blocked attempt to create a WebMediaPlayer as there are too many WebMediaPlayers already in existence. See crbug.com/1144736#c27
Files/URLs/Sources
audioplayers/lib/src/audioplayers_web.dart
Platforms
OS: web, Chrome
OS version: Chrome 92.0.4515.107
Device: physical, Windows 10
flutter version: Flutter 2.2.3 stable
audioplayers version: 0.19.1
The text was updated successfully, but these errors were encountered:
Chrome 92 has introduced a limit on the number of audio tags that can be allocated per tab. 75 for desktop, 40 for mobile. This causes issues when playing a lot of audio files, since currently the AudioElements are not removed after playing.
Full Description
AudioPlayers currently does not remove created AudioElements from the DOM. This obviously leads to issues when the browser has a hard limit of the number of AudioElements that can be active at once. Even calling
setUrl(String url)
will cause the issue to pop up eventually, since a new AudioElement is created every time.I've added a workaround that seems to fix the issue, but I'm not sure this would be the best way to solve it.
In audioplayers_web.dart change
release()
andstart(double position)
to the followingplayer?.src = '';
is important, since only callingplayer?.remove()
won't properly destroy the AudioElement.Code to Reproduce
Easiest way to reproduce is ofcourse to create an app with the latest AudioPlayers (0.19.1), and play a lot of audio using any of the available methods. Personally I'm using AudioCache but as a quick test I'm sure you could do something like
Log Errors
App error:
Browser error:
Files/URLs/Sources
Platforms
The text was updated successfully, but these errors were encountered: