修复windows
This commit is contained in:
@@ -114,20 +114,30 @@ async function updateVideoSrc() {
|
||||
return
|
||||
}
|
||||
|
||||
// Always use HTTP protocol for both Tauri and development
|
||||
// This works reliably in both environments
|
||||
const filename = raw.split('/').pop() || 'video.mp4'
|
||||
// Handle Windows paths with backslashes and drive letters
|
||||
const isWindowsPath = /^[a-zA-Z]:[\\/]|^\\/.test(raw)
|
||||
|
||||
// Use relative HTTP URL - this works in both Tauri and development
|
||||
if (filename === 'video.mp4') {
|
||||
videoSrc.value = '/video.mp4'
|
||||
if (isWindowsPath) {
|
||||
// Windows: Use Tauri's asset protocol for absolute paths
|
||||
// Convert backslashes to forward slashes and use asset:// protocol
|
||||
const normalizedPath = raw.replace(/\\/g, '/')
|
||||
videoSrc.value = `asset://localhost/${normalizedPath}`
|
||||
} else {
|
||||
videoSrc.value = `/${filename}`
|
||||
// Unix-like: Use HTTP protocol for both Tauri and development
|
||||
const filename = raw.split(/[/\\]/).pop() || "video.mp4";
|
||||
|
||||
// Use relative HTTP URL for bundled resources
|
||||
if (filename === 'video.mp4') {
|
||||
videoSrc.value = '/video.mp4'
|
||||
} else {
|
||||
videoSrc.value = `/${filename}`
|
||||
}
|
||||
}
|
||||
|
||||
console.log('🎥 Using HTTP URL for video:')
|
||||
console.log('🎥 Using URL for video:')
|
||||
console.log(' - Original path:', raw)
|
||||
console.log(' - HTTP URL:', videoSrc.value)
|
||||
console.log(' - Platform:', isWindowsPath ? 'Windows' : 'Unix')
|
||||
console.log(' - Final URL:', videoSrc.value)
|
||||
}
|
||||
|
||||
// Watch for changes in currentVideo and update videoSrc
|
||||
|
Reference in New Issue
Block a user