-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature-advance-notice
- Loading branch information
Showing
14 changed files
with
198 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: 问题反馈 | ||
about: 提交您在使用插件中遇到的 Bug 或错误 | ||
title: "[BUG] " | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
## 问题描述 | ||
简要描述您遇到的 Bug 或错误: | ||
|
||
## 复现步骤 | ||
请提供详细的复现步骤: | ||
|
||
1. 打开网址: | ||
2. | ||
3. | ||
|
||
## 预期表现 | ||
描述您期望的正确表现: | ||
|
||
## 实际表现 | ||
描述目前实际出现的错误或不符合预期的行为: | ||
|
||
## 屏幕截图或录像 | ||
如果可能,请附上相关截图或视频,以便更好地说明问题: | ||
|
||
## 运行环境 | ||
- 操作系统(OS): | ||
- 浏览器: | ||
- 浏览器版本: | ||
- 插件版本: | ||
|
||
## 其他信息 | ||
补充任何相关信息或日志: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: 新功能建议 | ||
about: 提交您对插件的新功能或改进的建议 | ||
title: "[Feature] " | ||
labels: "新功能 Feature" | ||
assignees: '' | ||
|
||
--- | ||
|
||
## 功能描述 | ||
简要描述您希望添加的新功能或改进: | ||
|
||
## 使用场景 | ||
请描述此功能的使用场景或带来的价值: | ||
|
||
## 您的建议 | ||
如果可以,请提供您对功能实现的详细建议或方案: | ||
|
||
## 其他信息 | ||
补充任何相关的上下文信息或参考资料: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { DataCache } from "../utils/cache"; | ||
|
||
export interface PlayInfo { | ||
id: number; | ||
frameRate: number; | ||
} | ||
|
||
export function getPlayInfo(playInfoCache: DataCache<string, PlayInfo[]>): PlayInfo[] { | ||
if (window.__playinfo__?.data?.dash?.video) { | ||
return window.__playinfo__.data.dash.video.map((v) => ({ id: v.id, frameRate: parseFloat(v.frameRate) })); | ||
} else if (playInfoCache.getFromCache(window?.__INITIAL_STATE__?.cid.toString())) { | ||
return playInfoCache.getFromCache(window.__INITIAL_STATE__.cid.toString()); | ||
} | ||
return []; | ||
} | ||
|
||
export function getFrameRate(playInfoCache: DataCache<string, PlayInfo[]>) { | ||
let currentQuality = null; | ||
try { | ||
currentQuality ||= JSON.parse(window?.localStorage?.bpx_player_profile)?.media?.quality; | ||
} catch (e) { | ||
console.debug("Failed to get current quality", e); | ||
} | ||
currentQuality = currentQuality ?? window?.__playinfo__?.data?.quality; | ||
|
||
const possibleQuality = getPlayInfo(playInfoCache).filter((v) => v.id === currentQuality && !!v.frameRate); | ||
|
||
if (possibleQuality.length > 0) { | ||
return possibleQuality[0].frameRate; | ||
} | ||
return 30; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.