Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

No image from TWebCamera

 Post Reply Post Reply
Author
Dino Gomezel View Drop Down
Member
Member
Avatar

Joined: 27 Aug 2018
Posts: 87
Post Options Post Options   Quote Dino Gomezel Quote  Post ReplyReply Direct Link To This Post Topic: No image from TWebCamera
    Posted: 07 Nov 2019 at 8:39am
Hello!

I have this code:

procedure TfrmNew.UpdatePicture;
var
  xhr: TJSXmlHttpRequest;
  P: integer;
  b64: string;
  function Base64ToArrayBuffer(str: string): TJSArrayBuffer;
  var
    BufView: TJSUInt8Array;
    BinaryString: string;
    I: Integer;
  begin
    BinaryString := window.atob(str);
    Result := TJSArrayBuffer.New(Length(BinaryString));
    BufView := TJSUInt8Array.New(Result);
    for I := 0 to Length(BinaryString) - 1 do
      BufView := TJSString(BinaryString).CharCodeAt(I);
  end;
begin
  xhr := TJSXMLHttpRequest.new;
  xhr.open('PUT', connServer.URL+'/'+string('pobuda('+wdsPobuda.FieldByName('Id').AsString+')/Slika'));
  b64 :=  camMain.SnapShotAsBase64;
  ShowMEssage(Copy(b64, 1, 40));  // shows only "data:,"
end;

The problem is that on iPhone the picture is always "data:,", on other deviced(PC/android..)  is "data:image/png,...". (this is correct).

I run this in Safari and Chrome for iOS, the result is the same. I know that running as PWS will not work, but I run just as an usual website in a browser.

From the documentation 
TWebCamera is using the MediaDevices.getUserMedia() API. Because of this, two mayor limitations are: • The TWebCamera won’t work in any browser that does not support the getUserMedia API. • It is not yet supported in iOS PWA.



Back to Top
Tunde Keller View Drop Down
TMS Support
TMS Support
Avatar

Joined: 03 Oct 2018
Posts: 10
Post Options Post Options   Quote Tunde Keller Quote  Post ReplyReply Direct Link To This Post Posted: 07 Nov 2019 at 10:31am
We have tested this here, but we could not reproduce it. The following worked correctly:
procedure TForm1.WebButton1Click(Sender: TObject);
var
  b64: string;
begin
  b64 :=  WebCamera1.SnapShotAsBase64;
  ShowMessage(Copy(b64, 1, 40));  
end;

procedure TForm1.WebFormCreate(Sender: TObject);
begin
  WebCamera1.Start;
end;
Do you have any special settings for the TWebCamera? Is it working properly apart from getting the image? What iOS version are you testing with?
Back to Top
Dino Gomezel View Drop Down
Member
Member
Avatar

Joined: 27 Aug 2018
Posts: 87
Post Options Post Options   Quote Dino Gomezel Quote  Post ReplyReply Direct Link To This Post Posted: 07 Nov 2019 at 9:57pm
Using iPhone 6s
IOS 13.1

Back to Top
Dino Gomezel View Drop Down
Member
Member
Avatar

Joined: 27 Aug 2018
Posts: 87
Post Options Post Options   Quote Dino Gomezel Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 2019 at 7:56am
Updated to iOS13.2.2, problem persists.
Latest version of WebCore
Back to Top
Tunde Keller View Drop Down
TMS Support
TMS Support
Avatar

Joined: 03 Oct 2018
Posts: 10
Post Options Post Options   Quote Tunde Keller Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 2019 at 8:54am
We've tried with a newer version of iOS, and it's still working.
So it's also important to know if you have any special settings for the TWebCamera? Is the control working properly apart from getting the image (SnapShotAsBase64) or do you also have problems with getting a live feed from it?
Back to Top
Dino Gomezel View Drop Down
Member
Member
Avatar

Joined: 27 Aug 2018
Posts: 87
Post Options Post Options   Quote Dino Gomezel Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 2019 at 11:33am
The control works correctly all except the SnapShotAsBase64 function. Na the error is only on Iphone (Safari browser). Im working to provide an example to send toy you, so we will have exactly the same code (and will also be a test form me if the problem is on the component or in my program).

See you soon :)
Back to Top
Dino Gomezel View Drop Down
Member
Member
Avatar

Joined: 27 Aug 2018
Posts: 87
Post Options Post Options   Quote Dino Gomezel Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 2019 at 2:36pm
Created a test program - works OK on my iOS, so the problem seems just in my application.

Tried to remove and readd the camera component, but no change :(

It just doesn't work on my iPhone. Tomorrow I willcheck on another iPhone that as never used onmy pages.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down