Why, after updating to 2.27, does Photon require camera permission on Android?

Following the update to 2.27 from 2.26.3, building an Android apk in Unity 2020.3.19f1 yields an AndroidManifest that includes:

<uses-permission android:name="android.permission.CAMERA" />

This is a VR app which does not and has never needed this permission, but its presence in the manifest prevents the build from being uploaded to the Oculus platform for distribution.

I thought I saw some interesting camera related code in PhotonVoice/PhotonVoiceApi/Platforms/UWP/CaptureDevice.cs , but deleting the whole UWP folder did not resolve the issue.

Is this a bug or is there a new feature flag that I've got to disable?

Best Answer

  • JohnTube
    JohnTube ✭✭✭✭✭
    Answer ✓

    Hi @imrsd_anthony,

    Thanks for your report!

    A reference to "UnityEngine.WebCamTexture" slipped into the latest update.

    Please wrap Photon.Voice.Unity.VideoInEnumerator class inside "PHOTON_VOICE_VIDEO_ENABLE" custom define as follows in file: "Assets\Photon\PhotonVoice\PhotonVoiceApi\Platforms\Unity\DeviceEnumerator.cs":

    #if PHOTON_VOICE_VIDEO_ENABLE
      public class VideoInEnumerator : DeviceEnumeratorBase
      {
        public VideoInEnumerator(ILogger logger) : base(logger)
        {
          Refresh();
        }
    
        public override void Refresh()
        {
          var unityDevs = UnityEngine.WebCamTexture.devices;
          devices = new List<DeviceInfo>();
          for (int i = 0; i < unityDevs.Length; i++)
          {
            var d = unityDevs[i];
            devices.Add(new DeviceInfo(d.name));
          }
        }
    
        public override string Error { get { return null; } }
    
        public override void Dispose()
        {
        }
      }
    #endif
    

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    Answer ✓

    Hi @imrsd_anthony,

    Thanks for your report!

    A reference to "UnityEngine.WebCamTexture" slipped into the latest update.

    Please wrap Photon.Voice.Unity.VideoInEnumerator class inside "PHOTON_VOICE_VIDEO_ENABLE" custom define as follows in file: "Assets\Photon\PhotonVoice\PhotonVoiceApi\Platforms\Unity\DeviceEnumerator.cs":

    #if PHOTON_VOICE_VIDEO_ENABLE
      public class VideoInEnumerator : DeviceEnumeratorBase
      {
        public VideoInEnumerator(ILogger logger) : base(logger)
        {
          Refresh();
        }
    
        public override void Refresh()
        {
          var unityDevs = UnityEngine.WebCamTexture.devices;
          devices = new List<DeviceInfo>();
          for (int i = 0; i < unityDevs.Length; i++)
          {
            var d = unityDevs[i];
            devices.Add(new DeviceInfo(d.name));
          }
        }
    
        public override string Error { get { return null; } }
    
        public override void Dispose()
        {
        }
      }
    #endif