Skip to content

Handling errors

Jongmoon Yoon edited this page Jul 31, 2018 · 1 revision

Raises an error event when an error occurs.

The type and message properties of the error handler's parameter can be used to determine what error occurred. view360 handles the following errors:

10: INVALID_DEVICE: Unsupported device

11: NO_WEBGL: WEBGL not supported

12, FAIL_IMAGE_LOAD: Failed to load image/video

13: FAIL_BIND_TEXTURE: Texture binding failed

14: INVALID_RESOURCE: Resource assignment error (only one of image or video must be specified)

Handling texture binding failure

viwer.on({
    "error" : function(err) {
        // err.type === 13
        // err.message === "failed to bind texture"
});

Handling rendering context lost

When you create multiple viewer instances, the browser deletes the oldest WebGL context and stops rendering. PanoViewer responds to this situation and automatically disables user interaction.

However, developers will also need to make UI changes to disabled viewers, so it is necessary to know when the rendering context is lost. This point of view notification is provided through the error event. If the event is an error event caused by rendering context lost, the value of the type property of the event object is 15.

panoViewer.on("error", function(e) {
    if (e.type === 15) { // rendering context lost
        // make UI changes on rendering context lost
    }
});
Clone this wiki locally