From 457f735934e6edb3b4eee610819be334c56aad27 Mon Sep 17 00:00:00 2001 From: Hiram <> Date: Sun, 15 Dec 2024 15:56:22 +0800 Subject: [PATCH] [change] use new multi-player --- .../src/components/player/src/utils/tool.ts | 4 +- .../src/locales/lang/en_US/pages/player.ts | 1 + .../src/locales/lang/zh_CN/pages/player.ts | 1 + src/renderer/src/pages/analyze/index.vue | 11 +- .../lab/components/snifferPlay/index.vue | 58 +++--- .../src/pages/play/componets/AsideFilm.vue | 172 +++++++++--------- .../pages/play/componets/DialogDownload.vue | 8 +- src/renderer/src/pages/play/index.vue | 30 +-- src/renderer/src/utils/common/film.ts | 62 ++++--- src/renderer/src/utils/tool.ts | 118 +----------- 10 files changed, 192 insertions(+), 273 deletions(-) diff --git a/src/renderer/src/components/player/src/utils/tool.ts b/src/renderer/src/components/player/src/utils/tool.ts index 1c947a786..f3b379d17 100644 --- a/src/renderer/src/components/player/src/utils/tool.ts +++ b/src/renderer/src/components/player/src/utils/tool.ts @@ -138,11 +138,11 @@ const mediaUtils = (() => { }; // 映射 Content-Type 到具体格式 - const mapContentTypeToFormat = (contentType: string): string => { + const mapContentTypeToFormat = (contentType: string): string | undefined => { const entry = Object.entries(supportedFormats).find(([type]) => contentType.includes(type) ); - return entry ? entry[1] : 'unknown'; + return entry ? entry[1] : undefined; }; // 使用 fetch 获取媒体类型 diff --git a/src/renderer/src/locales/lang/en_US/pages/player.ts b/src/renderer/src/locales/lang/en_US/pages/player.ts index ebe39cadf..a59b6089f 100644 --- a/src/renderer/src/locales/lang/en_US/pages/player.ts +++ b/src/renderer/src/locales/lang/en_US/pages/player.ts @@ -44,6 +44,7 @@ export default { official: 'Analyze completed, data is derived from {0}', noDefaultAnalyze: 'Not set default, Choose your own analysis line', noRecommendSearch: 'No recommendation found for this source, Switch is not performed', + noPlayUrl: 'Play address acquisition failed, please change the source or line', next: 'One moment, Switching next', }, placeholder: { diff --git a/src/renderer/src/locales/lang/zh_CN/pages/player.ts b/src/renderer/src/locales/lang/zh_CN/pages/player.ts index ff4a91f43..9fee624da 100644 --- a/src/renderer/src/locales/lang/zh_CN/pages/player.ts +++ b/src/renderer/src/locales/lang/zh_CN/pages/player.ts @@ -44,6 +44,7 @@ export default { sniiferError: '嗅探失败,请换源', noDefaultAnalyze: '未配置默认解析,自行选择解析线路', noRecommendSearch: '该源未找到相关推荐,不执行本次切换', + noPlayUrl: '播放地址获取失败,请换源或线路', next: '请稍候,正在切换下集', }, placeholder: { diff --git a/src/renderer/src/pages/analyze/index.vue b/src/renderer/src/pages/analyze/index.vue index f3c65168a..c624153ac 100644 --- a/src/renderer/src/pages/analyze/index.vue +++ b/src/renderer/src/pages/analyze/index.vue @@ -38,7 +38,7 @@
- +
@@ -71,14 +71,14 @@ import { putHistory, addHistory, findHistory } from '@/api/history'; import { fetchAnalyzeHelper } from '@/utils/common/film'; import emitter from '@/utils/emitter'; +import { MultiPlayer } from '@/components/player'; import DialogHistoryView from './components/DialogHistory.vue'; import DialogIframemView from './components/DialogIframe.vue'; import DialogSearchView from './components/DialogSearch.vue'; import SharePopup from '@/components/share-popup/index.vue'; import CommonNav from '@/components/common-nav/index.vue'; -import PlayerView from '@/components/player/index.vue'; -const store = usePlayStore(); +const storePlayer = usePlayStore(); const searchText = ref(''); const urlTitle = ref(''); // 播放地址的标题 const analyzeUrl = ref(''); // 输入需要解析地址 @@ -181,13 +181,12 @@ const getVideoInfo = async (url: string, title: string) => { playFormData.value.type = analyzeRes.mediaType; playFormData.value.url = analyzeRes.url; playFormData.value.headers = analyzeRes.headers; - const { playerMode } = store.setting; + const playerMode = storePlayer.setting.playerMode; if (playerMode.type === 'custom') { window.electron.ipcRenderer.send('call-player', playerMode.external, playFormData.value.url); } else { if (playerRef.value) { - await playerRef.value.init(); - await playerRef.value.create(playFormData.value); + await playerRef.value.create(playFormData.value, playerMode.type); }; } diff --git a/src/renderer/src/pages/lab/components/snifferPlay/index.vue b/src/renderer/src/pages/lab/components/snifferPlay/index.vue index 79131deeb..f15d75140 100644 --- a/src/renderer/src/pages/lab/components/snifferPlay/index.vue +++ b/src/renderer/src/pages/lab/components/snifferPlay/index.vue @@ -54,6 +54,7 @@ + @@ -65,7 +66,7 @@
- +
@@ -75,11 +76,13 @@