Merge branch 'master' of ssh://gitea.bowongai.com:222/bowong/mxivideo

This commit is contained in:
root 2025-07-11 16:54:57 +08:00
commit c19fb6366f
1 changed files with 14 additions and 3 deletions

View File

@ -25,6 +25,7 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
const [videoSrc, setVideoSrc] = useState<string>('') const [videoSrc, setVideoSrc] = useState<string>('')
const [fileExists, setFileExists] = useState<boolean>(true) const [fileExists, setFileExists] = useState<boolean>(true)
const [errorMessage, setErrorMessage] = useState<string>('') const [errorMessage, setErrorMessage] = useState<string>('')
const [loadingMethod, setLoadingMethod] = useState<'convertFileSrc' | 'dataUrl'>('convertFileSrc')
useEffect(() => { useEffect(() => {
const checkFileAndSetSrc = async () => { const checkFileAndSetSrc = async () => {
@ -268,7 +269,16 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
<AlertCircle size={64} className="mx-auto mb-4 text-red-400" /> <AlertCircle size={64} className="mx-auto mb-4 text-red-400" />
<h3 className="text-xl font-medium mb-2"></h3> <h3 className="text-xl font-medium mb-2"></h3>
<p className="text-gray-300 mb-4">{errorMessage}</p> <p className="text-gray-300 mb-4">{errorMessage}</p>
<p className="text-sm text-gray-400">: {videoPath}</p> <p className="text-sm text-gray-400 mb-4">: {videoPath}</p>
<p className="text-xs text-gray-500 mb-4">: {loadingMethod}</p>
{loadingMethod === 'convertFileSrc' && (
<button
onClick={tryDataUrlMethod}
className="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"
>
</button>
)}
</div> </div>
</div> </div>
) : ( ) : (
@ -277,14 +287,15 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
src={videoSrc} src={videoSrc}
className="w-full h-auto max-h-[70vh]" className="w-full h-auto max-h-[70vh]"
onClick={handlePlayPause} onClick={handlePlayPause}
onError={(e) => { onError={async (e) => {
console.error('Video loading error:', { console.error('Video loading error:', {
error: e, error: e,
videoSrc, videoSrc,
originalPath: videoPath, originalPath: videoPath,
currentTarget: e.currentTarget, currentTarget: e.currentTarget,
networkState: e.currentTarget.networkState, networkState: e.currentTarget.networkState,
readyState: e.currentTarget.readyState readyState: e.currentTarget.readyState,
currentMethod: loadingMethod
}) })
// 如果当前视频源失败,尝试重新加载 // 如果当前视频源失败,尝试重新加载
if (videoPath) { if (videoPath) {