# FAQ / How to ...?

# Playback

# How can we track the first play(ing) event?

If you want to run some code right after the first playback started, you can use the following

function onPlayStarted () {
    // some code

    // For example seek to a 5 second after playback started
    player.currentTime = 5;
}

player.once('playing', onPlayStarted)

// OR
player.once('loadedmetadata', onPlayStarted)
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadedmetadata_event

# Analytics

# How to disable analytics tracking?

During player creation pass analytics option as null.

const player = new PixellotWebSDK.Player(container, { analytics: null });

# Miscellaneous

# How to know whether a live stream is playing

The question is related to knowing if a stream is live or on-demand.

player.isLive; // true or false
Last Updated: 4/3/2023, 12:48:25 PM