Skip to content

Commit

Permalink
Feat: support mpd
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 committed Oct 10, 2023
1 parent fbe9c3e commit 4ef8872
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 0 deletions.
161 changes: 161 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"artplayer": "^5.0.9",
"artplayer-plugin-danmuku": "^5.0.1",
"axios": "^1.4.0",
"dashjs": "^4.7.2",
"element-plus": "^2.3.8",
"gsap": "^3.12.2",
"hls.js": "^1.4.12",
Expand Down
4 changes: 4 additions & 0 deletions src/components/MoviePush.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const movieTypeRecords: Map<pushType, movieTypeRecord> = new Map([
{
name: "ts",
value: "mpegts"
},
{
name: "mpd",
value: "mpd"
}
]
}
Expand Down
16 changes: 16 additions & 0 deletions src/components/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ watchers.push(
)
);
const playMpd = (player: HTMLMediaElement, url: string, art: any) => {
import("dashjs")
.then((dashjs) => dashjs.default)
.then((dashjs) => {
if (dashjs.supportsMediaSource()) {
const dash = dashjs.MediaPlayer().create();
dash.initialize(player, url, false);
art.dash = dash;
art.on("destroy", () => dash.reset());
} else {
art.notice.show = "Unsupported playback format: mpd";
}
});
};
const playFlv = (player: HTMLMediaElement, url: string, art: any) => {
import("mpegts.js")
.then((mpegts) => mpegts.default)
Expand Down Expand Up @@ -218,6 +233,7 @@ const playerOption = computed<Option>(() => {
customType: {
flv: playFlv,
m3u8: playM3u8,
mpd: playMpd,
mes: playMse,
ts: playMpegts,
m2ts: playM2ts,
Expand Down

0 comments on commit 4ef8872

Please sign in to comment.