Skip to content

Commit

Permalink
feat: auto skip failed resolves
Browse files Browse the repository at this point in the history
  • Loading branch information
lovegaoshi committed May 31, 2024
1 parent 76adb3c commit b2602b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/hooks/usePlayback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
initBiliHeartbeat,
} from '../utils/Bilibili/BiliOperate';
import { saveLastPlayDuration } from '../utils/ChromeStorage';
import { DEFAULT_NULL_URL } from '@objects/Song';

Check failure on line 16 in src/hooks/usePlayback.ts

View workflow job for this annotation

GitHub Actions / Lint

`@objects/Song` import should occur before import of `../utils/ffmpeg/r128util`

export default () => {
const playerSetting = useNoxSetting((state) => state.playerSetting);
Expand Down Expand Up @@ -63,12 +64,14 @@ export default () => {
const musicSrcParser = async (v: NoxMedia.Song) => {
try {
const resolvedUrl = await fetchPlayUrlPromise({ song: v });
// return currentAudioInst?.playNext?.();
if (resolvedUrl.url === DEFAULT_NULL_URL) {
throw new Error('resolve failed');
}
parseR128Gain(v, async () => resolvedUrl);
return resolvedUrl.url;
} catch (e) {
console.error(`[resolveURL] failed to resolve ${v}: ${e}`);
// throw e;
console.error(`[resolveURL] failed to resolve ${v.bvid}: ${e}`);
setTimeout(() => currentAudioInst?.playNext?.(), 1000);
return 'FAILED_TO_RESOLVE';
}
};
Expand Down Expand Up @@ -223,6 +226,7 @@ export default () => {
_audioLists: NoxMedia.Song[],
audioInfo: NoxMedia.Song,
) => {
// HACK: does this get called?
console.error('audio error', errMsg, audioInfo);
setTimeout(() => {
// console.debug('retrying...');
Expand Down
1 change: 0 additions & 1 deletion src/styles/skins/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const { gifs, backgroundImagesLandscape } = APMSkins['塞克西废墟']!;
export default () =>
skinTemplate({
playerBanner: PomeloTheme().playerBanner,
// playerBackground: async () => new Promise<string>((resolve) => { resolve('https://cdn.donmai.us/original/f5/cd/__watson_amelia_bubba_and_smol_ame_hololive_and_1_more_drawn_by_ro_g_oowack__f5cd65a11ff91b10f52aba05f46aa5e0.jpg'); }),
playerBackground: backgroundImagesLandscape,
gifs,
appTitle: '电鱼播放器',
Expand Down

0 comments on commit b2602b0

Please sign in to comment.