Compare commits
35 Commits
91a3673219
...
d27ec4d634
| Author | SHA1 | Date |
|---|---|---|
|
|
d27ec4d634 | |
|
|
a571ea8b32 | |
|
|
c09a989de8 | |
|
|
88380a98f0 | |
|
|
2138324cc0 | |
|
|
f4b459ee63 | |
|
|
05c4836919 | |
|
|
713ab605a7 | |
|
|
414bf603ba | |
|
|
e6fa18dfe2 | |
|
|
20733215aa | |
|
|
c9b2f08f15 | |
|
|
4e295be5eb | |
|
|
391866bcd7 | |
|
|
bcd1ff4032 | |
|
|
bc77de7b7f | |
|
|
dc57c5e5a8 | |
|
|
75d4ba0555 | |
|
|
41d7e22175 | |
|
|
f6c8f26ba3 | |
|
|
b8a87a8f32 | |
|
|
5d35aab1ab | |
|
|
39de519c88 | |
|
|
ac77e85f17 | |
|
|
caf28e765b | |
|
|
33e4939016 | |
|
|
c298d3c16d | |
|
|
98ee7d8d1d | |
|
|
a72101ad91 | |
|
|
28384f9f09 | |
|
|
a1d2dc0cc9 | |
|
|
30491fc797 | |
|
|
7306d12164 | |
|
|
a93d82084d | |
|
|
38a113097b |
|
|
@ -25,6 +25,7 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
|
|||
const [videoSrc, setVideoSrc] = useState<string>('')
|
||||
const [fileExists, setFileExists] = useState<boolean>(true)
|
||||
const [errorMessage, setErrorMessage] = useState<string>('')
|
||||
const [loadingMethod, setLoadingMethod] = useState<'convertFileSrc' | 'dataUrl'>('convertFileSrc')
|
||||
|
||||
useEffect(() => {
|
||||
const checkFileAndSetSrc = async () => {
|
||||
|
|
@ -268,7 +269,16 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
|
|||
<AlertCircle size={64} className="mx-auto mb-4 text-red-400" />
|
||||
<h3 className="text-xl font-medium mb-2">视频加载失败</h3>
|
||||
<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>
|
||||
) : (
|
||||
|
|
@ -277,14 +287,15 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
|
|||
src={videoSrc}
|
||||
className="w-full h-auto max-h-[70vh]"
|
||||
onClick={handlePlayPause}
|
||||
onError={(e) => {
|
||||
onError={async (e) => {
|
||||
console.error('Video loading error:', {
|
||||
error: e,
|
||||
videoSrc,
|
||||
originalPath: videoPath,
|
||||
currentTarget: e.currentTarget,
|
||||
networkState: e.currentTarget.networkState,
|
||||
readyState: e.currentTarget.readyState
|
||||
readyState: e.currentTarget.readyState,
|
||||
currentMethod: loadingMethod
|
||||
})
|
||||
// 如果当前视频源失败,尝试重新加载
|
||||
if (videoPath) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue