Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

IOS Webcam Access #218

Open
nejis opened this issue Jul 28, 2020 · 5 comments
Open

IOS Webcam Access #218

nejis opened this issue Jul 28, 2020 · 5 comments

Comments

@nejis
Copy link

nejis commented Jul 28, 2020

Is there any solution/workaround for the current "ios Bug" for ios WebViews to Acces the Camera of an device?

@Daddoon
Copy link
Owner

Daddoon commented Jul 28, 2020

I don’t what but you are talking about, but I assume that you are talking about something with the native webview.

At least, know that in the worst case, you can still call the camera API from native side (Xamarin).

If controlled from Blazor it would be:

  • Create an UI for that in your app, like a button.
  • Create a ProxyInterface in your app in order to call a task from BlazorMobile to Native (Xamarin)
  • In native side create your own camera handling logic like any regular Xamarin/Xamarin.Formd app.
  • Return the result as return value of your Method. This is not the best handling as it may overhead a little due to serialization, but it works. You may expose the result in different ways otherwise.

@nejis
Copy link
Author

nejis commented Jul 30, 2020

Thats the problem i cant use the default contoll, because i need to use the navigator.mediadevices Api of the browser and do not want to write serveral version of the same logic. But in Ios is curenntly an bug on all webview Contols that prevent the using of this api. Only in Safary it self it works. So i need an workaround to get the stream of the camera devices, to polifill the api or somthing like that, for streaming and live processing in an existing blazor pwa.

@Daddoon
Copy link
Owner

Daddoon commented Jul 30, 2020

I understand your issue.

From what i see and read, this issue is likely fixed in iOS 13.5.1 ?
Can you take a look ?

I am refering to this:

https://stackoverflow.com/questions/59685235/camera-bug-on-ios-13-3-pwa
https://bugs.webkit.org/show_bug.cgi?id=206219

If you still have issue, as this is a PWA InApp browser bug there is nothing more you can do except the tricks i mentionned, that are of course not specifically PWA standard.

Also, just double checking, do you have given any right in your app for camera access ? (even if you will be using it through webview). Like implementing this in your Info.plist:

<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to take photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photos.</string>

@nejis
Copy link
Author

nejis commented Jul 30, 2020

Unfortunately no. thats an other bug. it's this bug https://bugs.webkit.org/show_bug.cgi?id=208667

@Daddoon
Copy link
Owner

Daddoon commented Jul 30, 2020

Seem that Apple is not wanting to fix this so fast. (https://stackoverflow.com/questions/45055329/does-webkit-in-ios-11-beta-support-webrtc/49467964#49467964 , https://developer.apple.com/forums/thread/134216 ).

Sorry, but if this kind of functionnality is mandatory for your app, i don't see any other solution at the moment than using the "native capabilities" of your app, i mean if you are using BlazorMobile for a standalone app, if it's a pure PWA, you are out of luck.

In my opinion, as you are working with Blazor, i would do 2 different interfaces implementation in C# as services for your WebRTC/Media functionnality. One that would call the regular implementation in javascript under the hood, and the other one that would do the "tricks" in native for getting the same informations and results for iOS.

It seem that there is some implementations of WebRTC for Xamarin and iOS for native side, you may try to implement them in native, depending the complexity of your needs of course.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants