Search code examples
javascriptvue.jsquasar

Retrieving the values ​of an event on 'QMediaPlayer' from Quasar


I would like to retrieve the curTime and remaining value of the event in my QMediaPlayer component as cleanly as possible.

I have tested several syntaxes, but without success.

Example of my code:

this.$root.$on('timeupdate', (curTime, remaining) => {
    console.log('curTime: ', curTime)
    console.log('remaining', remaining)
}))

Quasar Doc

enter image description here

Do you have an idea ? thanks in advance


Solution

  • Try something like this @timeupdate="onTimeUpdate":

    In a template

    // other component options
    @timeupdate="onTimeUpdate"
    

    In code:

    methods: {
      onTimeUpdate(curTime, remaining) {
        console.log('curTime: ', curTime)
        console.log('remaining', remaining)
      }
    }