fix(tracks) Always add audio track on Safari.
This fixes an issue where Safari users cannot hear remote audio if they join audio/video muted. The browser throws the following error when the application tries to execute play on the audio element: 'NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.' This started happening in Safari 15.
This commit is contained in:
parent
fc6e8fd4b9
commit
2572ba9a65
|
@ -59,7 +59,6 @@ import {
|
|||
setAudioOutputDeviceId,
|
||||
updateDeviceList
|
||||
} from './react/features/base/devices';
|
||||
import { isIosMobileBrowser } from './react/features/base/environment/utils';
|
||||
import {
|
||||
browser,
|
||||
isFatalJitsiConnectionError,
|
||||
|
@ -835,9 +834,9 @@ export default {
|
|||
this._initDeviceList(true);
|
||||
|
||||
if (initialOptions.startWithAudioMuted) {
|
||||
// Always add the audio track to the peer connection and then mute the track on mobile Safari
|
||||
// because of a known issue where audio playout doesn't happen if the user joins audio and video muted.
|
||||
if (isIosMobileBrowser()) {
|
||||
// Always add the track on Safari because of a known issue where audio playout doesn't happen
|
||||
// if the user joins audio and video muted, i.e., if there is no local media capture.
|
||||
if (browser.isWebKitBased()) {
|
||||
this.muteAudio(true, true);
|
||||
} else {
|
||||
localTracks = localTracks.filter(track => track.getType() !== MEDIA_TYPE.AUDIO);
|
||||
|
@ -1357,8 +1356,8 @@ export default {
|
|||
APP.conference.roomName,
|
||||
this._getConferenceOptions());
|
||||
|
||||
// Filter out the tracks that are muted (except on mobile Safari).
|
||||
const tracks = isIosMobileBrowser() ? localTracks : localTracks.filter(track => !track.isMuted());
|
||||
// Filter out the tracks that are muted (except on Safari).
|
||||
const tracks = browser.isWebKitBased() ? localTracks : localTracks.filter(track => !track.isMuted());
|
||||
|
||||
this._setLocalAudioVideoStreams(tracks);
|
||||
this._room = room; // FIXME do not use this
|
||||
|
@ -2295,9 +2294,9 @@ export default {
|
|||
|
||||
// Remove the tracks from the peerconnection.
|
||||
for (const track of localTracks) {
|
||||
// Always add the track on mobile Safari because of a known issue where audio playout doesn't happen
|
||||
// if the user joins audio and video muted.
|
||||
if (audioMuted && track.jitsiTrack?.getType() === MEDIA_TYPE.AUDIO && !isIosMobileBrowser()) {
|
||||
// Always add the track on Safari because of a known issue where audio playout doesn't happen
|
||||
// if the user joins audio and video muted, i.e., if there is no local media capture.
|
||||
if (audioMuted && track.jitsiTrack?.getType() === MEDIA_TYPE.AUDIO && !browser.isWebKitBased()) {
|
||||
promises.push(this.useAudioStream(null));
|
||||
}
|
||||
if (videoMuted && track.jitsiTrack?.getType() === MEDIA_TYPE.VIDEO) {
|
||||
|
|
Loading…
Reference in New Issue