Search code examples
javascriptjqueryphotosphereviewer

viewer.getPlugin(PhotoSphereViewer.MarkersPlugin) return null


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 ?


Solution

  • 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>