3

I've been using electron for GUI interface development, recently I came across Tauri as electron alternative and coming to realize that the same code works on electron but not Tauri where:

<video controls preload src="file:\\C:\Users\User\Desktop\HelloTest\testVideo.mp4" ></video>

I've already tried:

<video controls preload src="C:\Users\User\Desktop\HelloTest\testVideo.mp4" ></video>

and the error is still Not allowed to load local resource: file:///.....

it works in electron by disabling the webSecurity:false in webPreference, is there any ways I can disable web security in Tauri, so that I can use local resources (videos from C:// or D://) in Tauri, my Tauri are using Angular as frontend

V Sing
  • 31
  • 1
  • 2
  • 1
    [this](https://tauri.studio/docs/api/js/modules/tauri/) is the api to covert asset url's, but its bugged as of now https://github.com/tauri-apps/tauri/issues/3725 – t348575 Mar 17 '22 at 18:06

1 Answers1

0

You can configure the security. Take a look at the documentation here: https://tauri.app/v1/api/js/modules/fs#security

  {
   "tauri": {
     "allowlist": {
       "fs": {
        "scope": ["$APP/databases/*"]
    }
  }

.Paths accessed with this API must be relative to one of the base directories so if you need access to arbitrary filesystem paths, you must write such logic on the core layer instead.

Rodrigo Diniz
  • 13
  • 1
  • 7