Tangerine
Tangerine copied to clipboard
Enable photo and video capture to save files on PWA's
Current version: v3.26.0
Currently photo and video save to file only on APK's. This code uses an older API that is pretty clunky and does not support PWA's, which makes testing and development difficult. The recent File System Access API is better suited for our needs. Unsure if we can completely abandon the Cordova file plugin - we may still need it for file access on APK's - but supporting both APK's and PWA's is a fair goal.
See WIP in 3465_enable-media-capture-on-pwas branch. There still needs to be a button rendered to the screen for a button to trigger showDirectoryPicker(). Perhaps the visibility of this picker could be triggered by variablesService.get('media-directory-dir-picked').
Ideas: We might be able to shift this code to the relevant tangy-form inputs. If we go that route, may need to add a new property to those elements for browserMediaFilesDirHandle created by showDirectoryPicker from the File System Access API
Good overview of the new File System Access API: https://web.dev/file-system-access/#ask-the-user-to-pick-a-file-to-read