feat: 添加通过 CDN 加载视频/音频#184
Open
Haisei wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
关联#121 ,同时解决视频加载速度慢的问题。
B 站默认返回的视频/音频地址有时会落到较慢的节点(海外党默认卡的要死),
导致视频加载慢、卡顿。本 PR 增加一个可配置的「首选 CDN」,让用户把播放地址的host 替换为更快、更稳定的节点,从而加速加载。
改动
Bilibili_Config.json:新增cdnHost配置项(默认留空)。MediaPlayParse - Bilibili.as:Config新增cdnHost字段;ReadConfigFile读取时做规范化(自动去掉用户误填的scheme://前缀和结尾/)。replaceCdnHost(url):把 URL 的 host 段(含端口)替换为cdnHost,保留 scheme 与 path、query;cdnHost为空时原样返回。baseUrl,以及durl的url与backup_url。README.md:新增「指定视频 CDN」使用说明。使用方法
在
Bilibili_Config.json填写cdnHost即可,例如(香港CDN地址):测试
cdnHost后播放,确认与改动前行为一致