Search code examples
javascriptgoogle-chromegoogle-chrome-extension

Chrome extension issue for audio playing


I'm trying to add audio playing and set duration. But Can't see the time, min and second control bar. Can someone help with this?

$("#audio").on("canplaythrough", function(e){
    var seconds = e.currentTarget.duration;
    var duration = moment.duration(seconds, "seconds");
    
    var time = "";
    var hours = duration.hours();
    if (hours > 0) { time = hours + ":" ; }
    
    time = time + duration.minutes() + ":" + duration.seconds();    
    
    URL.revokeObjectURL(objectUrl);
});

Solution

  • I think you just add the time value to any element. for example

    $("#id).text(time);
    

    Please let me know if it helps.