Repository navigation
fix: 歌词时间标签小数部分的前导零被丢掉,导致部分行延后显示 - #3048
Merged
Merged
Conversation
formatTimeLabel() strips leading zeros from the fraction, so [00:20.05] became 20.5 and was padded to 500 ms instead of 50 ms. Compute the time from the original label and keep the formatted label only as the map key.
Refactor msTime handling for better formatting.
Owner
|
thx! |
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.
相关 #2855
line-player.js在算时间之前先用formatTimeLabel()去掉了小数部分的前导零。歌词里没有三位小数的时间标签时(isMsTime为 false),小数会按百分秒补零,所以[00:20.05]先变成20.5,再补成500毫秒,而不是 50 毫秒。小数为.01~.09的行都会晚 0.27~0.81 秒显示。这里改为用原始时间标签计算时间,
formatTimeLabel()的结果仍只作为linesMap的 key,翻译和罗马音的匹配不变。三位小数(毫秒)的歌词结果也不变。用 #2855 里的网易云歌词《不老梦》(全部是两位小数)测试:
[01:09.08][02:31.03]修改后 53 行带文字的歌词全部与标签一致。