Skip to content

file:// not allowed to load local resource #1438

Answered by niemes
rafma0 asked this question in Q&A
Discussion options

You must be logged in to vote

Up, same problem.

I would like to change the source of a videoPlayer and end up with this error/limitation.
Any solution or documentation to load local file ?

Thank you

EDIT

We should also mention that we need to add the :asset protocole in the csp for this to work normally.
in the file tauri.conf.json add in the csp key "asset:"

I find the way to use local file, you need to get the link from the api like that :
source : Doc Tauri

      window.__TAURI__.dialog.open().then( (localPath) => {
        console.log("Video selected", localPath)
        
        let apiPath = window.__TAURI__.tauri.convertFileSrc(localPath)
        console.log('API Path', apiPath)
        window.videoPlayer.src =…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@FabianLars
Comment options

@abkarim
Comment options

@Siirko
Comment options

@kzhui125
Comment options

@YMC-GitHub
Comment options

Answer selected by rafma0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet