集成媒体会话API,支持视频和图文的播放状态同步与元信息更新;重构搜索页面,避免编译警告
This commit is contained in:
@@ -58,7 +58,6 @@ export default async function AwemeDetail({ params }: { params: Promise<{ awemeI
|
||||
const commentsCount = await prisma.comment.count({
|
||||
where: isVideo ? { videoId: id } : { imagePostId: id },
|
||||
});
|
||||
|
||||
const aweme = isVideo ? video : post;
|
||||
|
||||
const data: AwemeData = {
|
||||
@@ -73,6 +72,8 @@ export default async function AwemeDetail({ params }: { params: Promise<{ awemeI
|
||||
const aweme = video!
|
||||
return {
|
||||
type: "video" as const,
|
||||
cover_url: getFileUrl(aweme!.cover_url ?? 'default-cover.png'),
|
||||
cover_size: { h: aweme.height ?? 0, w: aweme.width ?? 0 },
|
||||
duration_ms: aweme!.duration_ms,
|
||||
video_url: getFileUrl(aweme!.video_url),
|
||||
width: aweme!.width ?? null,
|
||||
@@ -82,7 +83,9 @@ export default async function AwemeDetail({ params }: { params: Promise<{ awemeI
|
||||
const aweme = post!
|
||||
return {
|
||||
type: "image" as const,
|
||||
images: aweme!.images.map(img => ({ ...img, url: getFileUrl(img.url), animated: getFileUrl(img.animated ?? 'default-animated.png'), })),
|
||||
cover_url: getFileUrl(aweme!.images[0].url ?? 'default-cover.png'),
|
||||
cover_size: { h: aweme!.images[0].height ?? 0, w: aweme!.images[0].width ?? 0 },
|
||||
images: aweme!.images.map(img => ({ ...img, url: getFileUrl(img.url), animated: img.animated? getFileUrl(img.animated) : null })),
|
||||
music_url: getFileUrl(aweme!.music_url || 'default-music.mp3'),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user