Doesn't work with chrome on video files
- Dominant language
- JavaScript
- Stars
- 51
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
With small video (mp4) files, chrome has no issues. However if I use a 34 mbish sort of a video file. It will sometimes play the first 2 secs, like (5%) of the file or just stay stuck in limbo and not respond to the request. The code I have is pretty simple:
```js
import fs from 'fs';
import Koa from 'koa';
import koaLogger from 'koa-logger';
import koaRange from 'koa-range';
const app = new Koa();
const router = new koaRouter();
app
.use(koaLogger())
.use(koaRange)
/*
* TEST VIDEO STREAM
*/
router.get('/test', async (ctx, next) => {
ctx.type = 'video/mp4';
ctx.body = fs.createReadStream(__dirname + '/test.mp4');
});
app
.use(router.routes())
.use(router.allowedMethods())
.listen('3000');
```
It works fine on firefox, but I think firefox doesn't even use ranges for video. It also works fine when koaRange is removed as a middleware but then it would not seek, as expected. Using the latest version of koa and koa-range
Contributor guide
Research direction
Start by reproducing the Chrome request with the 34 MB test.mp4 using the shown Koa app, comparing koaRange enabled and disabled. Inspect the koa-range middleware behavior for Chrome's video range requests and compare the response with Firefox; done means the file plays and seeking works reliably in Chrome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100