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

Videos with small file size won't load from local file system #2854

Closed
rafma0 opened this issue Nov 9, 2021 · 5 comments
Closed

Videos with small file size won't load from local file system #2854

rafma0 opened this issue Nov 9, 2021 · 5 comments
Assignees

Comments

@rafma0
Copy link

rafma0 commented Nov 9, 2021

Describe the bug

Videos with small file size won't load from local file system

To Reproduce

I encoded the same video with different sizes from 18mb to 75kb and the two smallest ones won't load with the html5 video player
https://drive.google.com/u/0/uc?id=1DooRCgDgyFh45kbfl0XohAcErNVfwQ6r&export=download

It seems to be related to the headers from the local assets server

When I try to load for example the file '5.mp4' (74kb) from the local disk, using something like

<video>
  <source src="https://asset.localhost/e:/my/video/5.mp4" type="video/mp4" />
</video>

the server replies with

content-length: 409600
content-range: bytes 0-409599/75990
Content-Type: video/mp4

and the video gets stuck

but when I load the same file from a nginx server to the same tauri app the reply is

Content-Length: 75990
Content-Range: bytes 0-75989/75990
Content-Type: video/mp4

and everything works fine

Platform and Versions (required):

Operating System - Windows, version 10.0.22000 X64
Webview2 - 95.0.1020.44

Node.js environment
  Node.js - 16.4.2
  @tauri-apps/cli - 1.0.0-beta.10
  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 7.18.1
  yarn - 1.22.10

Rust environment
  rustc - 1.56.1
  cargo - 1.56.0

App directory structure
/build
/node_modules
/public
/src
/src-tauri

App
  tauri.rs - 1.0.0-beta.8
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self' asset:
  distDir - ../build
  devPath - http://localhost:3000
  framework - React
@kimlimjustin
Copy link
Contributor

Can confirm this bug here, the 4.mp4 and 5.mp4 don't want to load and the preview tab of the network tab on devtools say
Failed to load response data: No data found for resource with given identifier.

image

Should be something wrong with the encoding and decoding....

@rafma0
Copy link
Author

rafma0 commented Nov 25, 2021

To add a little more info on the issue.. seems like the assets server is assuming 400kb is the minimum size for a video file or something, and thats whats causing the problems

Looking at the source I see 2 files with

 if range.length > file_size / 3 {
  // max size sent (400ko / request)
  // as it's local file system we can afford to read more often
  real_length = 1024 * 400;
}

file 5.mp4 contains 75990 bytes and the server is replying on first request

Content-Length: 409600 // 400kb?
Content-Range: bytes 0-409599/75990 // 0 to 400kb? - 1 / 74kb (file size)
Content-Type: video/mp4

@michelvocks
Copy link

michelvocks commented Dec 3, 2021

I have the same issue but also noticed that even longer videos (e.g. ~2 minutes long) suddenly stop loading at 9-10 seconds. The video progress bar shows that there is more but the player is unable to play the video after ~9 seconds.

@lucasfernog
Copy link
Member

@michelvocks if #3039 doesn't fix it, please open another issue.

@michelvocks
Copy link

@lucasfernog #3039 fixed it. Thanks a lot!

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

No branches or pull requests

4 participants