AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://OvenMediaEngine.com/ovenplayer
MIT License
508 stars 124 forks source link

How to know if player is currently playing or paused? #353

Closed Pernifloss closed 1 year ago

Pernifloss commented 1 year ago

I've developed a viewer count for OvenPlayer and I wanted to know if the video was playing or paused to stop, sending request when it is paused.

How can I find the info from api variable inside a OvenTemplate?

const ViewerCountDisplay = function ($container, api, data)
{
...

    return OvenTemplate($container, "ViewerCountDisplay", api.getConfig(), data, events, onRendered, onDestroyed);
}

Thanks.

Pernifloss commented 1 year ago

Oh, I found api.getState() that return "idle", "playing", "paused", "error". Sorry, thanks anyway.