admin管理员组文章数量:1295302
It looks like getUserMedia()
is now the way to go for capturing audio recordings from a user.
But that leaves out Safari and iOS Safari.
Originally I had at least planned to included iOS Safari by taking advantage of the HTML Media Capture spec. From everything I've read, this is suppose to work. But from my tests, iOS will only offer the photo/video options. I've tried the following syntaxes with no luck:
<input type="file" accept="audio/*;capture=microphone" />
<input type="file" accept="audio/*" capture="microphone">
<input type="file" accept="audio/*" />
Capturing an image works as expected, though, allowing the user to use the camera:
<input type="file" accept="image/*" />
What do I need to change in order to get iOS Safari to work with HTML Media Capture when needing access to the microphone?
And are there any other options available for both Safari and iOS Safari other than what I'm already attempting to do?
It looks like getUserMedia()
is now the way to go for capturing audio recordings from a user.
But that leaves out Safari and iOS Safari.
Originally I had at least planned to included iOS Safari by taking advantage of the HTML Media Capture spec. From everything I've read, this is suppose to work. But from my tests, iOS will only offer the photo/video options. I've tried the following syntaxes with no luck:
<input type="file" accept="audio/*;capture=microphone" />
<input type="file" accept="audio/*" capture="microphone">
<input type="file" accept="audio/*" />
Capturing an image works as expected, though, allowing the user to use the camera:
<input type="file" accept="image/*" />
What do I need to change in order to get iOS Safari to work with HTML Media Capture when needing access to the microphone?
And are there any other options available for both Safari and iOS Safari other than what I'm already attempting to do?
Share Improve this question asked Apr 26, 2017 at 0:39 jabacchettajabacchetta 50.3k11 gold badges68 silver badges80 bronze badges 1- 2 Your first two lines of code are part of obsolete HTML Media Capture specs from 2011-2012 and should not be used anymore . See Correct Syntax for HTML Media Capture for more details. – octavn Commented May 2, 2017 at 11:54
3 Answers
Reset to default 4Safari on iOS 6+ supports the HTML Media Capture spec but only for videos and photos:
<input type="file" accept="image/*" />
<input type="file" accept="video/*" />
It does not support audio only capture so the following will not produce the expected oute:
<input type="file" accept="audio/*" />
Android supports all 3 (video, audio, image).
Thus support across Android and iOS is as follows:
With Safari on iOS 10.3 the capture
boolean attribute is also supported. It indicates capture directly from the webcam is preferred. When used, the option to choose an existing video or image will not be offered on Safari on iOS 10.3+:
<input type="file" accept="image/*" capture />
I've written more on the HTML Media Capture topic at https://blog.addpipe./correct-syntax-html-media-capture/
UPDATE: New in Safari 11.0 (iOS 11) – Camera and microphone access. Added support for the Media Capture API. Added ability for websites to access camera and microphone streams from a user's device (user permission is required.)
https://developer.apple./library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_11_0.html
Safari still doesn't support getUserMedia
properly.
It fails on this:
imgCapture = new ImageCapture(stream.getVideoTracks()[0]);
This works in Chrome but Safari has no idea what ImageCapture()
is.
本文标签: javascriptSafari and Recording AudioHTML Media CapturegetUserMedia()Stack Overflow
版权声明:本文标题:javascript - Safari and Recording Audio — HTML Media CapturegetUserMedia() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741611684a2388295.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论