Adding a list of live sessions to your website

Learn how to add a custom list of upcoming, live or past sessions to your website.

The Flux Panda Player renders a list of all published or live sessions by default. However, in certain circumstances you may want to create your own listing of sessions on your website.

You can use the Embedded SDK FluxPlayer.getSessions(): Session[] API to load a list of all available sessions.

FluxPlayer.getSessions().then((sessions) => {
    console.log(sessions);
    // Render live sessions
    var live_sessions = sessions.filter(function (session) {
        return session.status === "live";
    });
    if (live_sessions.length > 0) {
        // render your list here
    }

    // Render upcoming sessions
    var upcoming_sessions = sessions.filter(function (session) {
        return (
            session.event_date > Date.now() &&
            session.event_date < new Date().addHours(24) &&
            session.status === "published"
        );
    });
    if (upcoming_sessions.length > 0) {
        // render your list here
    }

    // past sessions
    var past_sessions = sessions.filter(function (session) {
        return (
            session.name != null &&
            session.event_date < Date.now() &&
            session.status === "published"
        );
    });
    if (past_sessions.length > 0) {
        // render your list here
    }
});