Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to play local video #25

Open
4 tasks done
GregorGabric opened this issue Jan 26, 2024 · 5 comments
Open
4 tasks done

Unable to play local video #25

GregorGabric opened this issue Jan 26, 2024 · 5 comments

Comments

@GregorGabric
Copy link

Describe the bug

Even though I create the file handler and I registerSchemesAsPrivileged, the video still doesn't play while it starts playing with other templates

protocol.registerSchemesAsPrivileged([
  {
    scheme: 'app-file',
    privileges: {
      standard: true,
      secure: true,
      supportFetchAPI: true,
      stream: true
    }
  }
])

// inside app.whenReady()

protocol.handle('app-file', (request) => {
     // it never reaches this part
      console.log(request.url, 'HERE', request)
      return net.fetch(`file:///${decodeURI(request.url.slice('app-file://'.length))}`)
    })
    
    
    
    
 // inside render
 <video
        preload="auto"
        src="app-file:///users/gregor/Documents/movies/dji_1.MP4"
      />

Used Scaffolding

create-electron

Used Package Manager

npm

Validations

@GregorGabric GregorGabric added the bug Something isn't working label Jan 26, 2024
@alex8088
Copy link
Owner

protocol.handle should use local path but not file protocol

@alex8088 alex8088 removed the bug Something isn't working label Jan 27, 2024
@GregorGabric
Copy link
Author

I don't understand sorry.
Should it just be /users/and-so-on ?

@alex8088
Copy link
Owner

net.fetch should be the local path

@GregorGabric
Copy link
Author

protocol.handle never actually runs, the console.log never actually logs anything ever.

@alex8088
Copy link
Owner

alex8088/electron-vite#36

<script setup lang="ts">
const icon = 'app:///icon.png'
</script>

<template>
  <img :src="icon" />
</template>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants