Merge branch 'voip/correctly-release-the-cloned-stream' into 'main'

chore: Correctly release the cloned stream.

See merge request famedly/company/frontend/famedlysdk!1101
This commit is contained in:
td 2022-08-17 14:57:40 +00:00
commit ae1d7778d5
1 changed files with 6 additions and 6 deletions

View File

@ -82,11 +82,9 @@ class WrappedMediaStream {
Future<void> dispose() async {
renderer.srcObject = null;
if (isLocal() && !isGroupCall && stream != null) {
if (isWeb) {
for (final element in stream!.getTracks()) {
await element.stop();
}
if (isLocal() && stream != null) {
for (final element in stream!.getTracks()) {
await element.stop();
}
await stream?.dispose();
stream = null;
@ -735,7 +733,9 @@ class CallSession {
if (purpose == SDPStreamMetadataPurpose.Usermedia) {
speakerOn = type == CallType.kVideo;
if (!voip.delegate.isWeb && !voip.delegate.isBackgroud) {
if (!voip.delegate.isWeb &&
!voip.delegate.isBackgroud &&
stream.getAudioTracks().isNotEmpty) {
final audioTrack = stream.getAudioTracks()[0];
audioTrack.enableSpeakerphone(speakerOn);
}