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

Answer

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)
  }
}
Source: stackoverflow
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .