How to call LS2API event?

I don't know how to use event by LS2API , for example, in com.webos.media | webOS Open Source Edition, currenttime is used as "Signals/Events”, How to get the value of currenttime repeatedly, I want to know when does the video file play end.

To get currentTime, you can call subscribe method. When changing the status of media playback, media component will send updated status as below.

{
"currentTime": 75171
}
{
"bufferRange": {
"beginTime": 75171,
"endTime": 78,
"remainingTime": 3109,
"percent": 31
}
}

Direct use of com.webos.media by application developers is strongly discouraged. Instead, the media interfaces native to a particular application framework (e.g. Web, QT, SDL/NDL) should be used.