Код: Выделить всё
Unhandled Promise Rejection: AbortError: The operation was aborted.< /code> < /p>
Что я пробовал до сих пор: < /p>
[*] Попытался регулировать Cors в Strapi middlewares.js < /li>
< /ol>
{
name: 'strapi::cors',
config: {
origin: ['http://localhost:3000'], or //origin: ['*'],
methods: ['GET', 'HEAD', 'OPTIONS'],
headers: ['Content-Type', 'Authorization', 'Range'],
exposeHeaders: ['Content-Length', 'Content-Range'],
credentials: false,
keepHeaderOnError: true,
},
}
добавлен? /> Но, очевидно, ничего не помогло < /p>
Код ниже: < /p>
Код: Выделить всё
'use client';
// imports...
export const VideoComponent: FC = ({
video,
poster,
isVideoOnGrid,
maxWidthMobile,
maxWidthDesktop,
}) => {
const videoRef = useRef(null);
const [isPlaying, setIsPlaying] = useState(false);
const data = video.data.attributes;
const posterData = poster?.data?.attributes;
const src = data.url ? getAssetUrlPrefix() + data.url : '';
useEffect(() => {
const videoElement = videoRef.current;
if (!videoElement) return;
const handlePlay = () => setIsPlaying(true);
const handlePause = () => setIsPlaying(false);
videoElement.addEventListener('play', handlePlay);
videoElement.addEventListener('pause', handlePause);
return () => {
videoElement.removeEventListener('play', handlePlay);
videoElement.removeEventListener('pause', handlePause);
};
}, []);
const togglePlay = () => {
if (videoRef.current) {
if (isPlaying) {
videoRef.current.pause();
} else {
videoRef.current.play();
}
setIsPlaying(!isPlaying);
}
};
return (
console.log('Video can play through')}
onError={(e) => console.error('Video Error:', e)}
playsInline
preload="auto"
ref={videoRef}
width="100%"
poster={`${posterData?.url ? getAssetUrlPrefix() + posterData.url : ''}`}
>
Your browser does not support the video tag.
);
};
Подробнее здесь: https://stackoverflow.com/questions/797 ... ors-issues