camera does not open from iOS PWA

Dear All,


I have written a PWA which installs an icon when it loads first.The functionalites include offline storage using indexed db and camera.usage to upload photo.

In chrome running in android, everything works fine.

However in safari in iOS camera does not open when I lunch the app from the icon loaded into launcher screen.


Similarly, it does not throw any meaningful error message either ! we tried to use web inspector to inspect the error , but the page when launched from launcher icon does not show up in web inspector.


everything works fine when lunched from browser (online mode) . Please help us resolve this. below is a piece of code which we are using for camera


          <button
            className="btn  btn_gray my-2"
            onClick={this.takePhoto.bind(this)}
          >
            Take photo{" "}
          




takePhoto() {
    const {
      capturedImages,
      cameraHide,
      showaddimagesComponentScan
    } = this.props;
    let selectedPartNumber = this.props.selectedPartNumber;
    this.setState({
      hidevedio: false
    });
    const config = {
      sizeFactor: 1
    };


    let dataUri = this.cameraPhoto.getDataUri(config);
    this.setState({ dataUri }, () => {
      let _dataUri = this.state.dataUri;


      DB.InsertOrUpdate(DbConstant.tblImageTemp, {
        rowID: this.props.taskID,
        partNumber: this.props.partNumber,
        ImageURI: _dataUri
      });
    });
    // capturedImages.push({ partNumber: selectedPartNumber, imageURI: dataUri });
    this.setState({
      // capturedImages,
      cameraHide: false
    });
    this.cameraPhoto
      .stopCamera()
      .then(() => {
        console.log("Camera stoped!");
      })
      .catch(error => {
        console.log("No camera to stop!:", error);
      });
  }

Replies

I can confirm this is happening on iOS 15 as well. How dumb is that? Camera is accessible on Safari but not when we add it to home screen?

Apparently, this was fixed but with the new Rapid Security Response (16.5.1 (c)) update got reintroduced :(