Update Media Entry plays

Hi all,

I’m trying to update “plays” field of a media Entry but while the code runs without any problems/exceptions the value of the entry stays the same.

The code i’m using is below :

    try {
        String ks = client.getSessionService().start(ADMIN_SECRET, "admin",
                KalturaSessionType.ADMIN, PARTNER_ID, 86400, "disableentitlement");
        client.setKs(ks);
        client.setSessionId(ks);

        // Get Media Entry
        KalturaMediaEntry getMediaEntry = client.getMediaService().get(entry_id);
        // Get plays of Media Entry
        int plays = getMediaEntry.plays;

        int updatedPlays = plays + 1;

        // Create updated Media Entry with plays+1
        KalturaMediaEntry updatedMediaEntry = new KalturaMediaEntry();
        updatedMediaEntry.plays = updatedPlays;

        // Update
        client.getMediaService().update(entry_id, updatedMediaEntry);

     } catch (KalturaApiException e) {
        e.printStackTrace();
        Log.i(TAG, "Update Num of plays error: " + e.getMessage() );
    }

EDIT : as far as I can tell I can’t update “plays” field. I’m creating a url like this :

serviceUrl + '/p/' + partnerId + '/sp/' + partnerId + '00/playManifest/entryId/' + entryId + '/flavorIds/' + flavorIds.join(',') + '/format/applehttp/protocol/http/a.m3u8?ks=' + ks + '&referrer=' + base64_encode(application_name)

and I’m streaming it in an android app. But still “plays” doesn’t updates at all.

Isn’t the stats service responsible for updating num of plays ? I’m using it but when I check on KMC console plays field does not updates at all.

Hello,

The plays as displayed in KMC’s content tab, is updated as part of the DWH scripts which run from:
/etc/cron.d/kaltura-dwh

The script that handles this particular job is:
/opt/kaltura/app/alpha/scripts/dwh/dwh_plays_views_sync.sh
You can see it runs as the ‘kaltura’ user. You can run /opt/kaltura/bin/kaltura-run-dwh.sh directly from the shell to debug.
Note that it starts by cleaning old DWH logs:

rm /opt/kaltura/dwh/logs/*

So if you’d like to retain them, please move them aside first.

Hello @jess thanks for the reply.

I’m using Kaltura SaaS so I don’t think it’s possible what you are suggesting.

Hello @mes,

I see. For SaaS, please open a support ticket so the team can check it out.

Thanks,

1 Like