Reputation: 1
A react component that uses the Vimeo Player. Does anyone know how to catch the 404 error that the player throws in the console? seems that Vimeo has no api/event to handle those events during initiation? Would like to show an alternative screen if the video is not found.
let player = new Vimeo.default(videoPlayerContainer.current, {
url: videoUrl,
controls: true,
responsive: true,
transparent:false,
dnt:true,
color: '327ea5'
})
Searchd all documentation but cant seem to find anything. My guess is that the error is thrown from inside the iframe vimeo creates but there is no way of handling it.
Upvotes: 0
Views: 759
Reputation: 98
Try catching the rejected promise in the catch hook:
let player = new Vimeo.default(videoPlayerContainer.current, {
url: videoUrl,
controls: true,
responsive: true,
transparent: false,
dnt: true,
color: "327ea5",
}).catch(err => {
// handle error here
console.warn(err);
});
Upvotes: 0