How to correctly ask audio and video permission for iPhone|iPod|iPad platforms?

In the prejoin screen, I modify the asking of audio permissions. Currently, This is how I implement the asking of browser audio permission.

Since navigator.mediaDevices.getUserMedia(options) is not working on the iPhone platform, so I added a condition using navigator.getUserMedia()

Please see attached code snippet.

Is there any other correct and efficient way on how to implement a conditional statement on asking these permission?

I have a condition

 const options = {
        audio: true,
    };

    const { updateDevicePermission } = this;

    // navigator.mediaDevices.getUserMedia = for platforms using iPhone|iPod|iPad
    // navigator.mediaDevices = for the rest other platforms

    if (navigator.mediaDevices.getUserMedia !== null) {
        navigator.getUserMedia(
            options,
            function () {
                console.log("Permission accepted!");

                updateDevicePermission();
            },
            function (err) {
                //
            }
        );
        return;
    } else if (navigator.mediaDevices != undefined) {
        navigator.mediaDevices
            .getUserMedia(options)
            .then(function (stream) {
                console.log("Permission accepted!");

                updateDevicePermission();
            })
        return;
    } else {
    }
1 Like

On any browser running on iOS devices the volumen level for each participant is not working. This is not only happening at UI level, the volumen down/up at code level isn’t working either.

I came across this issue by implementing a translation service and is working perfect for non iOS devices.

Do you think is related?