MicrosoftDocs / msteams-docs

Source for the Microsoft Teams developer platform documentation.
https://aka.ms/teamsdev
Creative Commons Attribution 4.0 International
287 stars 509 forks source link

I have exactly the same issue as this one. Can I have a confirmation on the fix please@rizwanja Currently, there is no workaround to this. Support for device permissions on mobile is coming soon but we do not have a ETA to share. #4677

Closed joekthomas closed 1 year ago

joekthomas commented 2 years ago

@rizwanja Currently, there is no workaround to this. Support for device permissions on mobile is coming soon but we do not have a ETA to share.

Originally posted by @Gousia-Begum in https://github.com/MicrosoftDocs/msteams-docs/issues/1343#issuecomment-586833611

ghost commented 2 years ago

Hi joekthomas! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

HunaidHanfee-MSFT commented 2 years ago

If you are looking for camera or microphone support on mobile. It is now available please have a look at this doc - https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/device-capabilities/mobile-camera-image-permissions

The sample is also available to test it out . Please have a look - https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/tab-device-permissions/nodejs

Let us know if you are looking for something else.

Thanks

joekthomas commented 2 years ago

Hi @HunaidHanfee-MSFT, thanks for the response.I have already gone through the above documents and my setup is bit different. Problem is that the same setup works in iOS teams mobile app, teams desktop client, browsers etc. but not in android teams. So I would like to fix the root cause on android and move on. Kindly help here.

My current setup is as follows. I have a Web application developed in HTML, js and css embedded in a teams tab, which has a functionality of recording voice. The Web app is then embedded as a personal tab and given appropriate permissions as well. The tab is configured with SSO as per the MSFT documentation using teams Javascript sdk. The whole setup works fine in teams desktop client, browsers and also in iOS mobile clients. In all above situations the permissions pop up for microphone is asked from the user as expected. The only issue I'm facing is with Android mobile app for teams, as it never pops up for permissions of microphone. Hope the issue is now clear. Really appreciate if you can guide me here. More details as follows. navigator.mediaDevices.getUserMedia({audio:true,video:true}) gives permission pop-ups in iOS. But in android(here android means teams android application. On android+browsers the app is working as expected) it doesn't ask user permission. When I alerted the error it shows below message. Screenshot_20211124_105533

HunaidHanfee-MSFT commented 2 years ago

We will try to repro this at our end and I will let you know the findings. Meanwhile could you please try and use Microsoft teams SDK method .

microsoftTeams.media.selectMedia({ maxMediaCount: 1, mediaType: microsoftTeams.media.MediaType.Audio }, (error: microsoftTeams.SdkError, attachments: microsoftTeams.media.Media[]) => {
      // If there's any error, an alert shows the error message/code
      if (error) {
        if (error.message) {
          alert(" ErrorCode: " + error.errorCode + error.message);
        } else {
          alert(" ErrorCode: " + error.errorCode);
        }
      }

      if (attachments) {
        // taking the first attachment  
        let audioResult = attachments[0];
        // setting state for preview
        setAudio("data:" + audioResult.mimeType + ";base64," + audioResult.preview)
      }
    });

Refer here- https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/07075595edb11ad3a4de1e2b83a7f3d3675ce25d/samples/tab-device-permissions/nodejs/src/components/CaptureAudio.tsx#L22 <- The Sample is available to test Teams SDK device capabilities methods.

joekthomas commented 2 years ago

Hi @HunaidHanfee-MSFT, thanks for the response. Yes I have tried this code and it's working fine on android. But I have issue in retrieving blob on iOS devices. Please find the JSON.stringify result for both iOS and Android. The size on Android is shown 7. But the iOS shows 0. Due to this the blob retrieval with below code is not successful. Kindly check this issue as well and confirm. Android JSON.stringify(attachment[0]) Screenshot_20211125_165540

iOS teams app JSON.stringify(attachment[0]) IMG_20211125_165830

Team app version : 3.19.77.2021193101/1111 Code snippet used

IMG-9636

While using the Teams sdk method for recording as per documentation we know that we can supply the mediaInput parameter maxDuration in minutes as per this documentation. https://docs.microsoft.com/en-us/javascript/api/@microsoft/teams-js/microsoftteams.media.audioprops?view=msteams-client-js-latest I have couple of questions on the sdk method. 1.I have a requirement to make maxDuration as 10 seconds is that possible? 2.The teams sdk inbuilt record now stops with a manual click on the stop button. Is it possible to programmatically stop recording? I know reaching maxDuration terminates recording, is there any way we can call the stop button on any other custom condition.

Kindly help me here with your suggestions. Thank you for the support.

HunaidHanfee-MSFT commented 2 years ago

We don't have any control or API to change recording status to stop. It is not possible to stop recording programmatically

joekthomas commented 2 years ago

Hi @HunaidHanfee-MSFT, thanks for confirming that. Can I please request your confirmation on the iOS issue. Seems like it's a bug. Kindly find the above attachments and let me know incase any additional details required. Happy to assist in troubleshooting. Also if you can confirm on the maxDuration it would be great. Let me know if I need to follow up that on a different thread.

joekthomas commented 2 years ago

Hi @Wajeed-msft @v-chetsh can you please share some updates on this issue triage?

HunaidHanfee-MSFT commented 2 years ago

We are following up with the internal team. We will get back to you soon.

Thanks

joekthomas commented 2 years ago

@HunaidHanfee-MSFT, thanks for the acknowledgement.

HunaidHanfee-MSFT commented 2 years ago

@joekthomas - We have repro of the iOS issue where blob is coming as null (only for iOS) however we are able to get attachments[0].size for both iOS and Android.

We have used "@microsoft/teams-js": "^1.11.0", and tested on iOS 15.1.1 and Teams Client version - 3.20.77.2021202701/1121. Can you please try checking if there's update for Microsoft Teams client on iOS?

joekthomas commented 2 years ago

Hi @HunaidHanfee-MSFT, great you can repro the issue. Yes the issue occurs only on iOS and Android works like charm. I now have the exact same version of teams client and teams sdk as yours. Still getting the audio as null on iOS. However I'm currently on iOS 15.0.2 which I will update to latest available and confirm once again. Also when you say you are able to get attachment[0].size does that means on iOS you are getting the recorded audio by using above versions?

HunaidHanfee-MSFT commented 2 years ago

Yes. I am getting attachment[0].size on iOS. But blob is coming as null. For that I am raising a bug and concerned team will work on it. I will let you know once it is fixed and pushed to public rings.

Thanks

joekthomas commented 2 years ago

@HunaidHanfee-MSFT, thanks for that confirmation. Will wait for the resolution to be available. I think on android I have one more observation. After recording when the blob is ready from below method. I'm passing that to a function which creates an HTML audio element and by creating a object URL for the blob and place it on the player using src parameter . And the player is able to playback the recorded audio without any issue. audio Result.getMedia((error, blob) => { if(blob) { playAudio(blob) ; } }) ;

But the issue is on the total duration of the recorded voice. Even though I recorded only for 3 seconds the total duration on player is shown as 21:35 and this value changes for each recording. Please find the below screenshot for the reference. Seems like this is a display issue as the total duration of recorded voice is 3 seconds itself. Request your kind attention here as well to understand whether it's a bug on android. Screenshot_20211210_192815

joekthomas commented 2 years ago

@HunaidHanfee-MSFT, @Wajeed-msft, @v-chetsh, team i have an update on the above. Without doing any code change from my side I'm currently seeing the duration on android device in seconds than minutes before. But intreststingly the duration is double of what I record. Also when I play back the audio it has the same recording twice without any break in between which seems like the recorder of teams sdk has an issue. Please find the below screenshot for reference. As I'm in middle of a UAT session this has made some major challenges. Kindly request your attention ASAP. Happy to assist in the debugging process. Screenshot_20211213_161317 I would say the previous behaviour was better as it was only having a display bug in duration of recording and the recording was perfectly fine. But now it's a show stopper as if the recording itself is not working as expected. Teams Javascript Sdk version : 1.11.0 Teams client version (android) : Screenshot_20211213_162442

joekthomas commented 2 years ago

@HunaidHanfee-MSFT @Wajeed-msft @v-chetsh , on my further debugging I could confirm that this issue is due to the 10th Dec update for Teams android app. I have tested my application on the very lower version(1416/1.0.0.2021183702/1117) of teams android app and it works exactly same as it was till 10th December, with only the duration of recording shown on minutes even though the duration is only in seconds. As this seems to be a global issue I would like to ring the alarms for your fast action. Kindly take this in priority.

HunaidHanfee-MSFT commented 2 years ago

Thanks for the letting us know. I will again check and gives you update? Can you confirm once if you have seen it only on Android or iOS as well?

Can you share the code snippet written to playAudio?

joekthomas commented 2 years ago

@HunaidHanfee-MSFT, thanks for the response. The playAudio function just creates a html audio element and embed the audio blob in it. The code is shown below. IMG_20211214_154527

Regarding iOS recording: As you already mentioned we have a bug in exporting the blob data, I'm not using teams sdk for recording in iOS. Hence couldn't test the same on iOS.

HunaidHanfee-MSFT commented 2 years ago

Thanks for sharing the repro the steps. I am able to see that duration is wrong and raised bug for this one as well. I will keep you posted about updates.

joekthomas commented 2 years ago

@HunaidHanfee-MSFT, thanks for the reply. Could you please confirm you are testing in android app version(1416/1.0.0.2021183702/1117) or the latest version ending with 1209? If you are testing in latest version I thin the bug is on aduio stream duplication as if we are able to hear the same voice 2 times. If you are testing in version ending 1117 then you are right the duration is having a bug displaying the duration in minutes even though the actual duration is in seconds.

Sorry if I have confused you. But for me above is the experience and I hope this is a global issue.

HunaidHanfee-MSFT commented 2 years ago

Yes on the latest build I have raised a bug and you are correct, because of duplication duration is also getting doubled.

joekthomas commented 2 years ago

@HunaidHanfee-MSFT, thanks for the confirmation and support provided. Hope you will revert once you have the fixes available.

ChetanSharma-msft commented 1 year ago

Hello @joekthomas - Sorry for delay in response!! We are actively checking the status of bug with engineering team and let you know the updates, if we have any.

Nivedipa-MSFT commented 1 year ago

@joekthomas - We have tested this using tab-device-permission sample. Inside CaptureAudio.tsx update the function captureMedia as below -

function captureMedia() {
    let testInput : microsoftTeams.media.MediaInputs = { maxMediaCount: 1, mediaType: microsoftTeams.media.MediaType.Audio };

    //alert(testInput.audioProps?.maxDuration);

    microsoftTeams.media.selectMedia({ maxMediaCount: 1, mediaType: microsoftTeams.media.MediaType.Audio  }, (error: microsoftTeams.SdkError, attachments: microsoftTeams.media.Media[]) => {

      var au = document.createElement('video');

              au.setAttribute("id","audiorecord");

              var li = document.createElement('a');

              var link = document.createElement('a');

      // If there's any error, an alert shows the error message/code

      if (error) {

        if (error.message) {

          alert(" ErrorCode: " + error.errorCode + error.message);

        } else {

          alert(" ErrorCode: " + error.errorCode);

        }

      }

      if (attachments) {

        // taking the first attachment  

        let audioResult = attachments[0]; 

        audioResult.getMedia((error: microsoftTeams.SdkError, blob: Blob) => {

          var videoElement = document.createElement("audio"); 

            if (blob) 

            { 
              var url = URL.createObjectURL(blob);

              au.setAttribute('controls', 'true');

              au.setAttribute('src', url);

              link.href = url;

              link.download = "file1"+".wav";

              li.appendChild(au);

              li.appendChild(link);

              document.body.appendChild(li);

            }

          if (error) {

              if (error.message) {

                  alert(" ErrorCode: " + error.errorCode + error.message);

              } else {

                  alert(" ErrorCode: " + error.errorCode);

              }

          }

        });

        // setting state for preview

        setAudio("data:" + audioResult.mimeType + ";base64," + audioResult.preview) 
      }

    });

  }

Tested on: microsoft/teams-js 1.10.0 Android 8.1.0 Teams version 1416/1.0.0.2022434101/1218

https://user-images.githubusercontent.com/92150070/214535589-a0c2163c-f156-486e-ad02-ba5b190b6ec3.mp4

It was working fine at our end. Could you please test and confirm on this?

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 3 days of this comment.

joekthomas commented 1 year ago

Apologies team for the delay for response. I will check the same at my end and let you know.

On Fri, 31 Mar 2023 at 7:31 PM, msftbot[bot] @.***> wrote:

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 3 days of this comment.

— Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/msteams-docs/issues/4677#issuecomment-1491972551, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACN3TRQWMML2DCDIVIJLELTW63PTLANCNFSM5IT6NT2Q . You are receiving this because you were mentioned.Message ID: @.***>

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 3 days of this comment.