Maximum audio playbacks

PennController for IBEX Forums Support Maximum audio playbacks

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10880
    s.giannino
    Participant

    After a maximum of 3 clicks on the “play” button of an audio element, I’d want the audio element either to hide or to be disabled.
    Is it possible?

    Best,
    Sal

    #10920
    Jeremy
    Keymaster

    Hello,

    Use a Var element to keep track of how many times the Audio element was played:

    newVar("nplayed", 0)
    ,
    newAudio("audio", "file.wav")
      .callback( getVar("nplayed").set(v=>v+1)
        .test.is(3).success( getAudio("audio").remove() ) 
      ) 
      .print()
    ,
    newButton("Next").print().wait()
    

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.