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.
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?
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).