To prevent the Spine Player from displaying an error message directly on the page when there's an error, such as a CORS issue, you can modify the error handling in the player configuration. You can set a custom error handler in the configuration object passed to the Spine Player. This handler can be used to suppress the default error display and instead perform a custom action, such as logging the error or simply doing nothing. Here's an example of how you might configure this:
const player = new spine.SpinePlayer("player-container", {
jsonUrl: "path/to/your/spine.json",
atlasUrl: "path/to/your/spine.atlas",
error: function(error) {
console.error("Spine Player error:", error);
// Do nothing or handle the error as needed
}
});
By providing a custom function for the error
property, you can control what happens when an error occurs, such as logging it to the console or ignoring it entirely.