videojs-panorama icon indicating copy to clipboard operation
videojs-panorama copied to clipboard

how can i use the hotspot functions of videojs-panorama?

Open ssalbal opened this issue 7 years ago • 14 comments

Can i use hotspot text and image. Panorama HotSpot Support description. How can i use the hotspot function.?

ssalbal avatar Jul 17 '17 01:07 ssalbal

yes,

Here are the example code, please download beta version here. You can use both image and text,

For image, please parse dom to element.

Like

 element:  document.getElementById("hotspot")

 Markers: [
                {
                    location: {
                        lat: 0,
                        lon: 180
                    },
                    radius: 500,
                    element: "This is text 1 with long text"
                },
                {
                    location: {
                        lat: 20,
                        lon: 160
                    },
                    radius: 500,
                    element: "This is text 2 with long text",
                    onShow: function(){
                        console.log("text 2 is shown");
                    },
                    onHide: function(){
                        console.log("text 2 is hidden");
                    }
                }
            ]

yanwsh avatar Jul 17 '17 01:07 yanwsh

hotspot does not same to Markers. could you more detail example code?

ssalbal avatar Jul 17 '17 02:07 ssalbal

Could you explain how does it looks like?

yanwsh avatar Jul 17 '17 04:07 yanwsh

I just insert element & Markers to player.panorama options like below code. But, no text find on the video. I have to write more html5 hotspot code?

    player.panorama({
        clickToToggle: (!isMobile()),

        clickAndDrag: true,
        autoMobileOrientation: true,

        initFov: 100,  
        VREnable: isMobile(),

        NoticeMessage: (isMobile())? "please drag and drop the video" : "please mouse drag and drop the video",
        autoHideNotice: 3000, 

        element:  document.getElementById("hotspot"),
        Markers: [
            {
                location: {
                    lat: 0,
                    lon: 180
                },
                radius: 500,
                element: "This is text 1 with long text"
            },
            {
                location: {
                    lat: 20,
                    lon: 160
                },
                radius: 500,
                element: "This is text 2 with long text",
                onShow: function(){
                    console.log("text 2 is shown");
                },
                onHide: function(){
                    console.log("text 2 is hidden");
                }
            }
        ],

ssalbal avatar Jul 17 '17 08:07 ssalbal

Does it showing any console error?

yanwsh avatar Jul 17 '17 11:07 yanwsh

Yes. thereis no console error.

Just Got Warning Console log. VIDEOJS: WARN: videojs.plugin() is deprecated; use videojs.registerPlugin() instead.

assets/shark.mp4 panorama view well.

I'm using video.js ( Ver. 6.2.1) / three.js (Ver r75) / videojs-panorama.v5.js (Ver 1.0.0-beta)

Also tested with video.js(Ver 5.20.1). the result same - no hotspot text. no console error.

ssalbal avatar Jul 17 '17 15:07 ssalbal

Also I'm using O.S - Windows 7 , Browser - Chrome (Ver 59.0.3071.115)

ssalbal avatar Jul 17 '17 15:07 ssalbal

Could you send me your project files or send me a demo, so i can figure out what's wrong.

yanwsh avatar Jul 17 '17 16:07 yanwsh

yes. demo link here

It's just some modified index.html of videojs-panorama original file.

ssalbal avatar Jul 17 '17 16:07 ssalbal

Hey, looks like you are not use beta version. Only beta version support hotspot right now. Please download code here.

yanwsh avatar Jul 17 '17 17:07 yanwsh

it's my mistaken.. it is well display text hotspot with beta version. could you let me know, how to control hotspot "text size" "text color" and display image with text. also can i use clickable image with url link?

ssalbal avatar Jul 17 '17 17:07 ssalbal

If you right click and open console, you can see all the text showing on video is html dom, so you can add css code to change it.

        .vjs-marker{
            white-space: normal;
            width: 100px;
            font-size: 2em;
        }

yanwsh avatar Jul 17 '17 17:07 yanwsh

it was really big helpness to me. thanks to your help.

ssalbal avatar Jul 17 '17 18:07 ssalbal

Can you provide any example of working with image hotspot...!

Vishnuvarth avatar Jan 31 '18 15:01 Vishnuvarth