2

Is it possible to record audio using getUserMedia when the HTML page runs inside WKWebView or UIWebView in an iOS app?

I tried the test page Recording audio in Chrome for Android using web audio API and navigator.getUserMedia, loading it to a WKWebView by

- (void)viewDidLoad {
    [super viewDidLoad];
    WKWebView *w = [WKWebView new];
    self.view = w;
    [w loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://jsfiddle.net/JCFtK/embedded/result/"]]];
}

but the record button does not seem to do anything.

Then I tried Recorder.js and loading the sample page. It says navigator.getUserMedia not present! and I can't continue.

So is there anything I can do to configure WKWebView so that it accepts getUserMedia or is it not supported at all?

P.S. I am a newbie in iOS things.

Community
  • 1
  • 1
Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228

1 Answers1

1

navigator.getUserMedia is not supported in Safari browsers (desktop and mobile) Take a look at this: https://github.com/common-tater/wkwebview-getusermedia-shim

noamtcohen
  • 4,432
  • 2
  • 20
  • 14
  • According to https://caniuse.com/#search=getusermedia it should work in Safari now, but not using WKWebView/UIWebView (e.g. build from Cordova), nor in PWA context (see note n°3). Demand for better support seems rather strong : https://forums.developer.apple.com/thread/88052 – Maxime Pacary Feb 12 '19 at 09:46