Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bv resolve #352

Merged
merged 6 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
"@react-native-async-storage/async-storage": "^1.22.3",
"@react-native-community/netinfo": "^11.3.1",
"@react-native-cookies/cookies": "^6.2.1",
"@react-native/babel-preset": "^0.73.21",
"@react-native/metro-config": "^0.74.0",
"@react-navigation/drawer": "^6.6.14",
"@react-navigation/material-top-tabs": "^6.6.12",
"@react-navigation/native": "^6.1.16",
"@react-navigation/native-stack": "^6.9.25",
"@sentry/react-native": "^5.19.3",
"@react-native/babel-preset": "^0.75.0-main",
"@react-native/metro-config": "^0.75.0-main",
"@react-navigation/drawer": "^6.6.15",
"@react-navigation/material-top-tabs": "^6.6.13",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"@sentry/react-native": "^5.20.0",
"@sharcoux/slider": "^7.1.1",
"@shopify/flash-list": "^1.6.3",
"@shopify/flash-list": "^1.6.4",
"@shopify/react-native-skia": "0.1.225",
"axios": "^1.6.7",
"axios": "^1.6.8",
"babel-plugin-transform-remove-console": "^6.9.4",
"base64-js": "^1.5.1",
"big-integer": "^1.6.52",
Expand All @@ -55,7 +55,7 @@
"dayjs": "^1.11.9",
"deepmerge": "^4.3.1",
"dropbox": "git+https://[email protected]/lovegaoshi/dropbox-sdk-js.git",
"expo": "^50.0.11",
"expo": "^50.0.13",
"expo-clipboard": "~5.0.1",
"expo-document-picker": "~11.10.1",
"expo-image": "^1.10.6",
Expand All @@ -69,7 +69,7 @@
"lottie-react-native": "^6.7.0",
"lru-cache": "7.14.0",
"md5": "^2.3.0",
"metro": "^0.80.6",
"metro": "^0.80.7",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"qs": "^6.12.0",
Expand All @@ -87,7 +87,7 @@
"react-native-pager-view": "^6.2.3",
"react-native-paper": "^5.12.3",
"react-native-qrcode-svg": "^6.3.0",
"react-native-reanimated": "^3.8.0",
"react-native-reanimated": "^3.8.1",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-safe-area-context": "^4.9.0",
"react-native-screens": "3.29.0",
Expand All @@ -103,37 +103,37 @@
"react-native-vector-icons": "^10.0.3",
"react-native-video": "git+https://github.com/lovegaoshi/react-native-video.git#dev-android-cache",
"react-native-webview": "^13.8.1",
"react-native-windows": "^0.73.10",
"react-native-windows": "^0.73.11",
"react-use": "^17.5.0",
"use-debounce": "^10.0.0",
"uuid": "^9.0.0",
"ytdl-core": "git+https://[email protected]/lovegaoshi/node-ytdl-core.git",
"zustand": "^4.5.2"
},
"resolutions": {
"metro": "^0.80.6"
"metro": "^0.80.7"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.2",
"@babel/runtime": "^7.24.0",
"@babel/core": "^7.24.1",
"@babel/preset-env": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@babel/runtime": "^7.24.1",
"@react-native-community/eslint-config": "^3.2.0",
"@tsconfig/react-native": "^3.0.3",
"@types/d3": "^7.4.3",
"@types/he": "^1.2.3",
"@types/jest": "^29.5.12",
"@types/md5": "^2.3.5",
"@types/node": "^20.11.27",
"@types/react": "^18.2.65",
"@types/node": "^20.11.30",
"@types/react": "^18.2.67",
"@types/react-native": "^0.73.0",
"@types/react-native-background-timer": "^2.0.2",
"@types/react-native-share-menu": "^5.0.5",
"@types/react-native-video": "^5.0.20",
"@types/react-test-renderer": "^18.0.6",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@welldone-software/why-did-you-render": "^8.0.1",
"argparse": "^2.0.1",
"babel-jest": "^29.6.4",
Expand All @@ -145,7 +145,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"gts": "^5.2.0",
"jest": "^29.2.1",
Expand Down
10 changes: 5 additions & 5 deletions src/components/player/controls/WavyAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
Skia,
useClockValue,
useComputedValue,
useValue,
LinearGradient,
vec,
} from '@shopify/react-native-skia';
import { useDerivedValue, useSharedValue } from 'react-native-reanimated';
import { line, curveBasis } from 'd3';
import { colord } from 'colord';

Expand All @@ -32,8 +32,8 @@ export default function WaveAnimation({
progress = 0,
color = 'white',
}: Props) {
const verticalOffset = useValue(initialVerticalOffset);
const amplitude = useValue(initialAmplitude);
const verticalOffset = useSharedValue(initialVerticalOffset);
const amplitude = useSharedValue(initialAmplitude);
const clock = useClockValue();
const extrapolatedWidth = Math.max(width * progress * 0.9 - 3, 0);
const parsedColor = colord(color);
Expand All @@ -49,10 +49,10 @@ export default function WaveAnimation({
const angle = (1 - index / width) * (Math.PI * frequency) + phase;
return [
index,
amplitude.current *
amplitude.value *
gaussian(index / extrapolatedWidth, 1.3) *
(Math.sin(angle) - 1) +
verticalOffset.current +
verticalOffset.value +
17,
];
}
Expand Down
1 change: 1 addition & 0 deletions src/enums/MediaFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export enum SOURCE {
steriatk = 'steriatk',
ytbvideo = 'ytbvideo',
biliBangumi = 'biliBangumi',
biliLive = 'bililive',
local = 'local',
}
2 changes: 2 additions & 0 deletions src/localization/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"ClearOrphanedCacheName": "Clear Orphaned Cache",
"ClearOrphanedCacheDesc": "Clear all cached songs.",
"ClearOrphanedCacheDesc2": "Clear all orphaned cached {{val}} songs.",
"DebugLogName": "Player Status",
"DebugLogDesc": "Show TP's current status",
"LogLevel0": "DEBUG",
"LogLevel1": "INFO",
"LogLevel2": "WARN",
Expand Down
4 changes: 4 additions & 0 deletions src/localization/zhcn/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"ClearOrphanedCacheName": "清除失效的缓存",
"ClearOrphanedCacheDesc": "删除所有缓存的歌曲",
"ClearOrphanedCacheDesc2": "删除所有失效缓存的{{val}}首歌",
"DebugLogName": "显示TP日志",
"DebugLogDesc": "显示TP的日志",
"LogLevel0": "调试",
"LogLevel1": "一般",
"LogLevel2": "警告",
Expand All @@ -154,6 +156,8 @@
"LogLevel5": "关闭"
},
"Settings": {
"PluginsSettingName": "插件",
"PluginsSettingDesc": "你好特殊!开启隐藏的功能",
"GeneralSettingName": "播放器设置",
"GeneralSettingDesc": "一般的播放器设置",
"AppearanceSettingName": "播放器外观",
Expand Down
4 changes: 3 additions & 1 deletion src/objects/Song.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import he from 'he';

import { extractParenthesis } from '../utils/re';
import { reExtractSongName } from '@stores/appStore';
import { SOURCE } from '@enums/MediaFetch';
import { MUSICFREE } from '@utils/mediafetch/musicfree';

export const DEFAULT_NULL_URL = 'NULL';
export const NULL_TRACK = { url: DEFAULT_NULL_URL, urlRefreshTimeStamp: 0 };
Expand All @@ -23,7 +25,7 @@ interface SongProps {
duration?: number;
album?: string;
addedDate?: number;
source?: string;
source?: SOURCE | MUSICFREE;
isLive?: boolean;
liveStatus?: boolean;
metadataOnLoad?: boolean;
Expand Down
4 changes: 3 additions & 1 deletion src/types/media.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { SORT_OPTIONS, PLAYLIST_ENUMS } from '@enums/Playlist';
import { SOURCE } from '@enums/MediaFetch';
import { MUSICFREE } from '@utils/mediafetch/musicfree';

declare global {
namespace NoxMedia {
Expand All @@ -18,7 +20,7 @@ declare global {
duration: number;
album?: string;
addedDate?: number;
source?: string;
source?: SOURCE | MUSICFREE;
isLive?: boolean;
liveStatus?: boolean;
metadataOnLoad?: boolean;
Expand Down
7 changes: 3 additions & 4 deletions src/utils/mediafetch/bililive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import SongTS from '@objects/Song';
import { logger } from '../Logger';
import bfetch from '@utils/BiliFetch';
import { biliApiLimiter } from './throttle';

export const CIDPREFIX = 'bililive';
import { SOURCE } from '@enums/MediaFetch';

interface BiliLiveRoomInfo {
room_id: string;
Expand Down Expand Up @@ -49,14 +48,14 @@ const fetchVideoInfoRaw = async (aid: string) => {
const roomInfo = await getRoomInfo(aid);
const liverInfo = await getLiver(roomInfo.room_id);
return SongTS({
cid: `${CIDPREFIX}-${roomInfo.room_id}`,
cid: `${SOURCE.biliLive}-${roomInfo.room_id}`,
bvid: roomInfo.room_id,
name: roomInfo.title,
singer: liverInfo.uname,
cover: roomInfo.user_cover,
singerId: aid,
album: `b站直播间${aid}`,
source: CIDPREFIX,
source: SOURCE.biliLive,
isLive: true,
liveStatus: roomInfo.live_status === 1,
});
Expand Down
6 changes: 3 additions & 3 deletions src/utils/mediafetch/bilisublive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from 'axios';
import { regexFetchProps } from './generic';
import SongTS from '@objects/Song';
import { logger } from '../Logger';
import { CIDPREFIX } from './bililive';
import { SOURCE } from '@enums/MediaFetch';
import { fetchBiliPaginatedAPI } from './paginatedbili';

// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/live/info.md#%E6%89%B9%E9%87%8F%E6%9F%A5%E8%AF%A2%E7%9B%B4%E6%92%AD%E9%97%B4%E7%8A%B6%E6%80%81
Expand Down Expand Up @@ -33,9 +33,9 @@ const getRoomInfos = async (uids: number[]) => {
.map(
(roomInfo: any) =>
SongTS({
cid: `${CIDPREFIX}-${roomInfo.room_id}`,
cid: `${SOURCE.biliLive}-${roomInfo.room_id}`,
bvid: roomInfo.room_id,
source: CIDPREFIX,
source: SOURCE.biliLive,
name: roomInfo.title,
singer: roomInfo.uname,
singerId: roomInfo.uid,
Expand Down
6 changes: 4 additions & 2 deletions src/utils/mediafetch/bilivideo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const fetchVideoPlayUrlPromise = async ({
const json = await res.json();
return { url: extractResponseJson(json, extractType) as string };
} catch (e) {
logger.error(`[resolveURL] error: ${e}`);
logger.error(`[resolveURL] error: ${e} of bvid:${bvid}, cid:${cid}`);
throw e;
}
};
Expand Down Expand Up @@ -189,7 +189,9 @@ const extractResponseJson = (json: any, field: string) => {
} else if (json.data.dolby?.audio) {
return getBestBitrate(json.data.dash.dolby.audio).baseUrl;
}
return getBestBitrate(json.data.dash.audio).baseUrl;
if (json.data.dash) return getBestBitrate(json.data.dash.audio).baseUrl;
if (json.data.durl) return json.data.durl[0].url;
throw Error('[extractResponseJson] no audio url');
case FieldEnum.VideoUrl:
return json.data.dash.video[0].baseUrl;
case FieldEnum.CID:
Expand Down
Loading
Loading