首页 > 解决方案 > 如何修复设备相机不支持移动浏览器 React Js 的问题

问题描述

我创建了一个 React Js Web 应用程序;使用对话框组件打开相机并捕获实时图像。这适用于桌面浏览器,但不适用于手机和 Apple 设备。但在 Safari 浏览器中它可以完美运行。我怎样才能使它在其他浏览器中也能正常工作?

                      <Dialog 
                            fullScreen={fullScreen}
                            open={this.state.open}
                            onClose={this.handleClose}
                            aria-labelledby="responsive-dialog-title">
                            <DialogTitle className={"testClassForStyle"} id="responsive-dialog-title">{<Translate
                                id={"webCam"}></Translate>}</DialogTitle>
                            <DialogContent className={"camscreen"}>
                                <div className={"webCamCss"}>
                                    <center><Webcam
                                        audio={false}
                                        height={200}
                                        ref={this.setRef}
                                        screenshotFormat="image/jpeg"
                                        width={350}/></center>

                                    <center><Button onClick={this.capture} className="btn-success text-white">
                                        <Translate
                                            id={"capture"}></Translate></Button></center>
                                </div>
                            </DialogContent>
                            <DialogActions id="actions-btns">
                                <Button onClick={this.handleClose} className="btn btn-default text-white" autoFocus>
                                    <Translate id={"cancel"}></Translate>
                                </Button>
                                <Button onClick={this.handleAddClose} className="btn btn-primary text-white">
                                    <Translate id={"addBtn"}></Translate>
                                </Button>
                            </DialogActions>
                        </Dialog>

标签: javascriptandroidreactjsgoogle-chromemobile-safari

解决方案


推荐阅读