TmsFncWebbrowser

I am trying to connect to web page chat. And i get the error
Camera is not found.please make sure it is not blocked by another program
I give permision for camera and of course i dont use camera in another program.
Any suggestions ?

Hi,

We are unable to reproduce this, the camera works on our devices after enabling the permissions.

Which Delphi and Android version are you using?
Can you give us a sample project (or website) that we can use for testing?

I use Delphi 10.4.2
Sdk 25.2.5
My phone is Samsung Z3 Fold.
A similiar page to test is

https://webrtc.github.io/samples/src/content/insertable-streams/endtoend-encryption/

Are you giving permission for the camera manually? You'll need to give permission to audio recording as well. From the source code of the linked page:

const options = {audio: true, video: true};
navigator.mediaDevices
    .getUserMedia(options)
    .then(gotStream)
    .catch(function(e) {
      alert('getUserMedia() failed');
      console.log('getUserMedia() error: ', e);
    });

Notice audio: true, which means it needs audio permissions too. Doing this from code:

procedure TForm4.Button1Click(Sender: TObject);
const
  CAMERAPERMISSION = 'android.permission.CAMERA';
  AUDIOPERMISSION = 'android.permission.RECORD_AUDIO';
begin
  {$IF COMPILERVERSION >= 33}
  if not PermissionsService.IsPermissionGranted(CAMERAPERMISSION) or not PermissionsService.IsPermissionGranted(AUDIOPERMISSION) then
  begin
    PermissionsService.RequestPermissions([CAMERAPERMISSION, AUDIOPERMISSION],
      {$IF COMPILERVERSION > 34}
      procedure(const APermissions: TClassicStringDynArray; const AGrantResults: TClassicPermissionStatusDynArray)
      {$ELSE}
      procedure(const APermissions: TArray<string>; const AGrantResults: TArray<TPermissionStatus>)
      {$IFEND}
      begin
        //Navigate to URL only if BOTH permissions are granted
        if (Length(AGrantResults) = 2) and (AGrantResults[0] = TPermissionStatus.Granted) and (AGrantResults[1] = TPermissionStatus.Granted) then
          TMSFNCWebBrowser1.URL := 'https://webrtc.github.io/samples/src/content/insertable-streams/endtoend-encryption/';
      end
    );
  end;
  {$IFEND}
end;

I tried your code but not work to me.

compile project and i click allow.

open blank site not work.

if i rem the line of your code
if (Length(AGrantResults) = 2) and (AGrantResults[0] = TPermissionStatus.Granted) and (AGrantResults[1] = TPermissionStatus.Granted) then
the site loads

when i click start i take this error.

Did you get another popup asking for audio permissions & enabled it?
Have you added the Record audio permission to your project?

Yes i take a second popup says to allow record audio but when i press start still takes the same error.

Add Modify audio settings to your permissions as well.

Thank you very much works.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.