Giter Site home page Giter Site logo

Comments (6)

Hasankib avatar Hasankib commented on May 22, 2024

Hi, does this issue still need fixing? If so then I can give it a try.

from botonic.

YoniSchirris avatar YoniSchirris commented on May 22, 2024

So currently I still have the previous workaround in place:

i render with

render(){
<div>
        <CustomAudio id={this.context.session.messageId} src={"data:audio/mp3;base64," + this.context.session.resp.response} />
        {this.context.session.resp.options ? <DisplayClickables audioId={this.context.session.messageId} options={this.context.session.resp.options} /> : null}

</div>
}

with the DisplayClickables class being

class DisplayClickables extends React.Component{
  // React component that will display clickables after the audio has stopped playing

  constructor(props){

    super(props)

    if (props.alwaysShow) {
      this.state = {showOptions: false}

      setTimeout(() => {
        this.setState({showOptions: true})
      }, 2500);

    } else{
      this.state = {showOptions: false,
        audioId: props.audioId,
        audioOptionsId: props.audioId + '_options'
        }
        let return_el = null
        let startTime = new Date()  
        let timerId = setInterval(() => {
    
          if (document.querySelector('#' + this.state.audioId + ' #myAudio')){
            if(Math.floor((Date() - startTime/1000)/60) > 300){ // Stop checking the audio element after 5 minutes.
              clearInterval(timerId)
            }
    
            let audio_el = document.querySelector('#' + this.state.audioId + ' #myAudio') // get the latest posted audio element
            if (audio_el.ended){  // check if it has ended playing, this is a property of the html audio dom element
              clearInterval(timerId)  // then, stop checking
              this.setState({showOptions: true}) // change state to show the clickable options
            }
          }
        }, 800)
    }
  }

where the messageId is manually defined as

 session.messageId = 'a' + uuidv1().split("-").join("") // used to set id, id needs to start with character and can't have '-'

within the botonicInit.

I'm using
@botonic/cli/0.18.3 darwin-x64 node-v13.2.0

from botonic.

Hasankib avatar Hasankib commented on May 22, 2024

Ok, I will attempt something. I will get back to you if I am able to solve the issue.

from botonic.

TD-XiPengZhao avatar TD-XiPengZhao commented on May 22, 2024

Hello, I would like to ask this question, is there a solution in the future?

from botonic.

vanbasten17 avatar vanbasten17 commented on May 22, 2024

we'll consider adding this but it is not a priority. feel free to create a PR for this 🤗

from botonic.

vbsh123 avatar vbsh123 commented on May 22, 2024

Hey ,is it possible for me to work on this?
Or if its closed that means it doesn't need to be done?

from botonic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.