viewer.getPlugin(PhotoSphereViewer.MarkersPlugin) return null

614 views Asked by At

I use PhotosphereViewer for displaying panorama image.

I use the following code for initializing the viewer successfully -

var viewer = new PhotoSphereViewer.Viewer({
            panorama: '/images/myimage.jpg',
            container: 'stage',
            loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif',
            caption: 'Parc national du Mercantour <b>&copy; Damien Sorel</b>',
            defaultLat: 0.3,

            plugins: [
                [PhotoSphereViewer.MarkersPlugin, {
                    // list of markers
                    markers: [
                    ]
                }]
            ]
        });

After initializing the viewer I use the following command to get a reference to the MarkersPlugin -

var markersPlugin = viewer.getPlugin(PhotoSphereViewer.MarkersPlugin);

Any idea why markersPlugin is always null ?

2

There are 2 answers

0
Kiran Shinde On BEST ANSWER

You need to add markers.js file in your html

Like

<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/markers.js"></script>
2
kirsanv43 On

Maybe you need to add something to the markers, as in the example https://photo-sphere-viewer.js.org/plugins/plugin-markers.html#usage