• Resolved mor3311

    (@mor3311)


    Hi,
    I’m building a marketplace using Dokan which includes audio files.
    I would like to enable audio preview of 10 seconds on click or hover.

    I found a plugin (Music Player for WooCommerce) which enables the whole audio play, which I DON’T want to enable.

    Is it possible to enable only 10 seconds audio preview before purchase?

    Thanks, Mor

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Saiful Islam

    (@saifislam01)

    Hi @mor3311

    How to enable 10 seconds audio preview

    Right now, this kind of feature is unavailable with Dokan, where you can enable only a 10-second audio preview.

    To achieve this feature, you have to make a customization.

    I hope you understand.

    Cheers!

    Thread Starter mor3311

    (@mor3311)

    Hi Islam,
    Thank you! so I made a customization for that.
    If someone is interested, this is the code:
    (I got more than one audio tag so I used a loop. can use a setTimeout function either. I used the following listener because I want to cover client pause-and-play.)

    let audio = document.getElementsByTagName("audio");
    
        for (let element of audio) {
    		element.addEventListener("timeupdate", function () {
    				if (element.currentTime >= 10){
    					element.pause();
    					element.currentTime = 0;
    				}
    		}, false);
        };
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Preview 10 seconds of audio source’ is closed to new replies.