Permissions.askAsync() is allways staus == denied on web

I tried to use CAMERA with Expo refer to these pages.
The pages are written “you can use CAMERA on web”(checkmark). but I can not use CAMERA becouse Permissions.askAsync() is allways staus == denied on web (iOS and Android are OK, return granted)
https://docs.expo.io/versions/v36.0.0/sdk/camera/
https://docs.expo.io/versions/latest/sdk/permissions/

How to use CAMERA on web? or can not yet?(the pages are misstaked)

The sample code

import React, { useState, useEffect } from 'react';
import { Text, View, TouchableOpacity } from 'react-native';
import { Camera } from 'expo-camera';
import * as Permissions from 'expo-permissions';


export default function App() {
  const [hasPermission, setHasPermission] = useState(null);
  const [type, setType] = useState(Camera.Constants.Type.back);

  useEffect(() => {
    (async () => {
      // const { status } = await Camera.requestPermissionsAsync();
        const { status } = await Permissions.askAsync(Permissions.CAMERA);
        alert(status);
      setHasPermission(status === 'granted');
    })();
  }, []);

  if (hasPermission === null) {
    return <Text>Null</Text>;
  }
  if (hasPermission === false) {
    return <Text>No access to camera</Text>;
  }
  return (
      <View style={{ flex: 1 }}>
        <Camera style={{ flex: 1, width: 500, height: 500 }} type={type}>
          <View
              style={{
                flex: 1,
                backgroundColor: 'transparent',
                flexDirection: 'row',
              }}>
            <TouchableOpacity
                style={{
                  flex: 0.1,
                  alignSelf: 'flex-end',
                  alignItems: 'center',
                }}
                onPress={() => {
                  setType(
                      type === Camera.Constants.Type.back
                          ? Camera.Constants.Type.front
                          : Camera.Constants.Type.back
                  );
                }}>
              <Text style={{ fontSize: 18, marginBottom: 10, color: 'white' }}> Flip </Text>
            </TouchableOpacity>
          </View>
        </Camera>
      </View>
  );
}

Most permissions require a secure context. Please start your project with expo start --https. If you still see denied, it’s probably because the permissions were previously denied, you’ll need to reset them in your browser (on chrome this can be done by clicking the lock icon in the URL bar).

I opened an issue to make this clearer Permissions documentation is missing web info · Issue #7037 · expo/expo · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.