Skip to content

Commit 58340d3

Browse files
authored
fix(deps): install mpegts.js from github (#520)
Upgrade to GitHub commit, remove webworkify-webpack, add m2ts support - Fork mpegts.js from https://github.com/xqq/mpegts.js to https://github.com/OpenListTeam/mpegts.js - Specify GitHub commit version in project package.json - Add `prepare` hook in forked mpegts.js to support PNPM post-install build - Remove subdependency on webworkify-webpack to fix PNPM 11 `ERR_PNPM_EXOTIC_SUBDEP` issue - Enable automatic build after install with PNPM - Add m2ts playback support to video player - Align changes with upstream fixes after 1.8.0 (diff: xqq/mpegts.js@v1.8.0...c91ab33) --------- Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
1 parent 988929a commit 58340d3

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"mark.js": "^8.11.1",
9898
"mitt": "^3.0.1",
9999
"monaco-editor": "0.55.1",
100-
"mpegts.js": "^1.8.0",
100+
"mpegts.js": "github:OpenListTeam/mpegts.js#1e51e0f6f918cf08e05dfae9c7bfcf658d6b4ac2",
101101
"qrcode": "^1.5.4",
102102
"rehype-katex": "7.0.1",
103103
"rehype-raw": "^7.0.0",

pnpm-lock.yaml

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
allowBuilds:
22
"@swc/core": true
33
core-js: true
4+
mpegts.js: true
45
patchedDependencies:
56
# if https://github.com/chenxch/vite-plugin-dynamic-base/pull/36 is merged,
67
# this patch can be removed
78
vite-plugin-dynamic-base: patches/vite-plugin-dynamic-base.patch
9+
onlyBuiltDependencies:
10+
- mpegts.js

src/pages/home/previews/video.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@ const Preview = () => {
132132
flvPlayer.attachMediaElement(video)
133133
flvPlayer.load()
134134
},
135+
m2ts: function (video: HTMLMediaElement, url: string) {
136+
flvPlayer?.destroy()
137+
flvPlayer = mpegts.createPlayer(
138+
{
139+
type: "m2ts",
140+
url: url,
141+
},
142+
{ referrerPolicy: "same-origin" },
143+
)
144+
flvPlayer.attachMediaElement(video)
145+
flvPlayer.load()
146+
},
135147
m3u8: function (video: HTMLMediaElement, url: string) {
136148
hlsPlayer?.destroy()
137149
hlsPlayer = new Hls()

0 commit comments

Comments
 (0)