feat: bili player

This commit is contained in:
DIYgod
2024-07-04 00:40:15 +08:00
parent 9f10928cd9
commit 2d0537b57e
3 changed files with 15 additions and 2 deletions
+13
View File
@@ -100,6 +100,19 @@ export function createWindow(
},
)
window.webContents.session.webRequest.onBeforeRequest(async (details, callback) => {
const { url } = details
if (url.startsWith("https://s1.hdslb.com/bfs/seed/jinkela/short/player/player-util.js")) {
callback({
cancel: false,
redirectURL: `https://assets.follow.is/player-util.js`,
})
} else {
callback({ cancel: false })
}
})
return window
}
+1 -1
View File
@@ -1,6 +1,6 @@
export const urlToIframe = (url?: string | null) => {
if (url?.match(/\/\/www.bilibili.com\/video\/BV\w+/)) {
return `https://player.bilibili.com/player.html?${new URLSearchParams({
return `https://www.bilibili.com/blackboard/newplayer.html?${new URLSearchParams({
isOutside: "true",
autoplay: "true",
danmaku: "true",
@@ -37,7 +37,7 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP
// eslint-disable-next-line @eslint-react/dom/no-missing-iframe-sandbox
<iframe
src={iframeSrc}
className={cn("pointer-events-none aspect-video w-full shrink-0 rounded-md bg-black object-cover", isActive && "rounded-b-none")}
className={cn("aspect-video w-full shrink-0 rounded-md bg-black object-cover", isActive && "rounded-b-none")}
/>
) : (
<Image