├── .npmrc ├── .gitignore ├── .editorconfig ├── tsconfig.json ├── LICENSE ├── package.json ├── src ├── index.ts ├── decoder.ts └── matroska-schema.ts └── README.md /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | dist 3 | node_modules 4 | 5 | */**/node_modules 6 | */**/dist 7 | */**/.DS_Store 8 | */**/*.log 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | # Unix-style newlines with a newline ending every file 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | charset = utf-8 9 | indent_style = space 10 | indent_size = 2 11 | trim_trailing_whitespace = true 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "src", 4 | "lib": ["ESNext", "DOM", "DOM.Iterable"], 5 | "target": "es6", 6 | "module": "CommonJS", 7 | "moduleResolution": "node", 8 | "esModuleInterop": true, 9 | "noImplicitAny": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "noEmitOnError": true, 15 | "noImplicitThis": true, 16 | "strictNullChecks": true, 17 | "allowSyntheticDefaultImports": true, 18 | "skipLibCheck": true, 19 | "declaration": true, 20 | "rootDir": "src", 21 | "outDir": "dist", 22 | "jsx": "react", 23 | "sourceMap": true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sta Zhu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fix-webm-metainfo", 3 | "version": "1.0.8", 4 | "description": "a lib based on ts-ebml and support large file (>2GB)", 5 | "author": "StaZhu", 6 | "license": "MIT", 7 | "main": "dist/index.js", 8 | "files": [ 9 | "dist", 10 | "README.md", 11 | "LICENSE" 12 | ], 13 | "keywords": [ 14 | "webm", 15 | "mediaRecorder" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "git@github.com:StaZhu/fix-webm-meta.git" 20 | }, 21 | "devDependencies": { 22 | "rimraf": "^3.0.2", 23 | "typescript": "^4.3.3" 24 | }, 25 | "dependencies": { 26 | "buffer": "^5.7.1", 27 | "int64-buffer": "^0.1.10", 28 | "ts-ebml": "^2.0.2" 29 | }, 30 | "scripts": { 31 | "build": "npm run clear && tsc", 32 | "dev": "npm run clear && tsc -w", 33 | "clear": "rimraf dist", 34 | "increase": "npm version patch", 35 | "increase:alpha": "npm version prerelease --preid=alpha", 36 | "deploy": "npm run build && npm run increase && npm publish", 37 | "deploy:alpha": "npm run build && npm run increase:alpha && npm publish --tag alpha" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { tools, Reader } from 'ts-ebml'; 2 | import LargeFileDecorder from './decoder'; 3 | 4 | /** 5 | * fix webm media file without 2GB filesize limit 6 | * 7 | * @param the blob you need to fix 8 | * @returns the blob that has been fixed 9 | * 10 | * using this function can not only add "Duration" but also add "SeekHead", "Seek", "SeekID", "SeekPosition" for the webm 11 | * if a webm loss "SeekHead", "Seek", "SeekID", "SeekPosition" and "Cues", "CueTime", "CueTrack", "CueClusterPosition", "CueTrackPositions", "CuePoint", 12 | * then the webm will not seekable when playing in chrome with builtin