Skip to content

Commit 9dae4dc

Browse files
author
Taois
committed
feat: 切换代理播放地址后及时反馈到调试按钮界面
1 parent 012ad1b commit 9dae4dc

File tree

3 files changed

+378
-356
lines changed

3 files changed

+378
-356
lines changed

dashboard/src/components/players/ArtVideoPlayer.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,19 @@ const currentQuality = ref('默认')
196196
const availableQualities = ref([])
197197
const currentPlayingUrl = ref('')
198198
199+
// 代理设置变化追踪器 - 用于强制 proxyVideoUrl 计算属性重新计算
200+
const proxySettingsVersion = ref(0)
201+
199202
// 计算属性:是否显示调试按钮
200203
const showDebugButton = computed(() => {
201204
return !!props.videoUrl
202205
})
203206
204207
// 计算属性:代理后的视频链接
205208
const proxyVideoUrl = computed(() => {
209+
// 依赖 proxySettingsVersion 以响应代理设置变化
210+
proxySettingsVersion.value
211+
206212
// 使用当前实际播放的URL,如果没有则使用props.videoUrl
207213
const actualUrl = currentPlayingUrl.value || props.videoUrl
208214
if (!actualUrl) return ''
@@ -1555,6 +1561,10 @@ const handleResize = () => {
15551561
// 处理代理设置变化
15561562
const handleAddressSettingsChange = () => {
15571563
console.log('检测到代理设置变化,重新初始化播放器')
1564+
1565+
// 更新代理设置版本号,强制 proxyVideoUrl 计算属性重新计算
1566+
proxySettingsVersion.value++
1567+
15581568
if (props.videoUrl && props.visible) {
15591569
nextTick(() => {
15601570
initArtPlayer(props.videoUrl)

dashboard/src/components/players/VideoPlayer.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ const currentQuality = ref('默认')
208208
const availableQualities = ref([])
209209
const currentPlayingUrl = ref('')
210210
211+
// 代理设置变化追踪器 - 用于强制 proxyVideoUrl 计算属性重新计算
212+
const proxySettingsVersion = ref(0)
213+
211214
// 初始化画质数据
212215
const initQualityData = () => {
213216
if (props.qualities && props.qualities.length > 0) {
@@ -326,6 +329,9 @@ const showDebugButton = computed(() => {
326329
327330
// 计算属性:代理后的视频链接
328331
const proxyVideoUrl = computed(() => {
332+
// 依赖 proxySettingsVersion 来响应代理设置变化
333+
proxySettingsVersion.value
334+
329335
// 使用当前实际播放的URL,如果没有则使用props.videoUrl
330336
const actualUrl = currentPlayingUrl.value || props.videoUrl
331337
if (!actualUrl) return ''
@@ -866,6 +872,10 @@ watch(() => props.initialQuality, (newQuality) => {
866872
// 处理代理设置变化
867873
const handleAddressSettingsChange = () => {
868874
console.log('检测到代理设置变化,重新初始化播放器')
875+
876+
// 更新代理设置版本号,强制 proxyVideoUrl 计算属性重新计算
877+
proxySettingsVersion.value++
878+
869879
if (props.videoUrl && props.visible) {
870880
nextTick(() => {
871881
initVideoPlayer(props.videoUrl)

0 commit comments

Comments
 (0)