[ad_1]
Only if you handle the click event manually through js and run some code to play the sound.
Thank you for your reply.
Could you briefly tell me the code I can use?
I’ve tried this and that, but it doesn’t work.
You can try this code below. It’s just a sample. Note: each marker can store a data (see marker properties), we can use this field for mp3 URL or other logic. In my example I echo this field value (marker.data) to the browser console.
const plugin = this;
const $ = jQuery;
plugin.$container.on('click', '.ipnrm-marker', (e) => {
const $marker = $(e.currentTarget);
const markerId = $marker.attr('data-marker-id');
const scene = plugin.viewer.sceneActive;
if(scene) {
const marker = scene.cfg.markers.find(x => x.id === markerId);
if(marker) {
console.log(marker.data);
const audio = new Audio('https://assets.mixkit.co/active_storage/sfx/940/940-preview.mp3');
audio.play();
}
}
});
It works perfectly.
Thanks. I appreciate your help.
- This reply was modified 3 minutes ago by donsign.
