How to use MediaDevices.getUserMedia () correctly?

PC browsers can call the permission request form normally, for example, XXX wants to use your camera / microphone and so on:

QQ:

but the problem encountered is that the phone has its own browser, or third parties such as UC, Via, Cheetah, etc., cannot provide similar pop-up windows, which are prohibited by default.

is there a solution?

In addition, MDN pointed out in the API article that "the returned promise object may neither resolve nor reject, because the user does not have to choose to allow or deny."

Jan.26,2022

Thank you for the invitation.

Mobile browser compatibility is impossible, especially for people like getUserMedia, which requires hardware to interact with each other. It is possible to find a similar Polyfill to do the characteristics of the phenotype, but when dealing with hardware, it is basically impossible, just impossible, and can only wait for the upgrading of mobile devices (because, like many brands of Android, native systems are not upgraded, they have to adapt and teach users, empty production costs are not profitable, manufacturers do not bother to do that, and they will not take care of loopholes). Or hang under a large platform (such as Wechat or Ali) in order to do this business, which is the cost to be considered in technology selection.

when it comes to the specific implementation, in addition to Apple's native Safari, the mobile devices are Wechat X5 and UC (Ali APP) of Android platform. The latter two have compatibility quick check platform, x5 in ide/caniuse/index.html" rel=" nofollow noreferrer "> X5 CanIUse , UC in U4 Platform Status , and these two cores are also supported on the website. As for Safari, although there is document , I may not be in the right position to open it, so I can't quite understand it. However, in addition to these three cores, the probability of support is really not high, so if you have to do this feature, the strategy is to drive users to these supported platforms as much as possible.


Why do I call the return notallowed, in the Google browser on the web without popping up the user authorization confirmation box? why is this?

Menu