Search in sources :

Example 1 with Analytics

use of com.zype.android.webapi.model.player.Analytics in project zype-android by zype.

the class VideoDetailActivity method handleVideoPlayer.

@Subscribe
public void handleVideoPlayer(PlayerVideoEvent event) {
    Logger.d("handlePlayer");
    String url = event.getEventData().getModelData().getResponse().getBody().getFiles().get(0).getUrl();
    DataHelper.saveVideoPlayerLink(getContentResolver(), mVideoId, url);
    Advertising advertising = event.getEventData().getModelData().getResponse().getBody().getAdvertising();
    Analytics analytics = event.getEventData().getModelData().getResponse().getBody().getAnalytics();
    if (advertising != null) {
        List<AdvertisingSchedule> schedule = advertising.getSchedule();
        DataHelper.updateAdSchedule(getContentResolver(), mVideoId, schedule);
        // in the 'Video' table. But we do this now because the tags are the same for all ad cue points
        if (schedule != null && !schedule.isEmpty()) {
            String adTag = advertising.getSchedule().get(0).getTag();
            DataHelper.saveAdVideoTag(getContentResolver(), mVideoId, adTag);
        }
    }
    if (analytics != null) {
        String beacon = analytics.getBeacon();
        AnalyticsDimensions dimensions = analytics.getDimensions();
        if (beacon != null && dimensions != null) {
            DataHelper.updateAnalytics(getContentResolver(), beacon, dimensions);
        }
    }
    mType = PlayerFragment.TYPE_VIDEO_WEB;
    changeFragment(isChromecastConntected());
}
Also used : AdvertisingSchedule(com.zype.android.webapi.model.player.AdvertisingSchedule) Advertising(com.zype.android.webapi.model.player.Advertising) AnalyticsDimensions(com.zype.android.webapi.model.player.AnalyticsDimensions) Analytics(com.zype.android.webapi.model.player.Analytics) Subscribe(com.squareup.otto.Subscribe)

Example 2 with Analytics

use of com.zype.android.webapi.model.player.Analytics in project zype-android by zype.

the class VideoHelper method getAnalytics.

public static Analytics getAnalytics(ContentResolver contentResolver, String videoId) {
    Analytics result = new Analytics();
    Cursor cursor = CursorHelper.getAnalyticsByVideoId(contentResolver, videoId);
    if (cursor != null) {
        if (cursor.moveToFirst()) {
            String beacon = cursor.getString(cursor.getColumnIndexOrThrow(Contract.AnalyticBeacon.BEACON));
            result.setBeacon(beacon);
            AnalyticsDimensions dimensions = new AnalyticsDimensions();
            String siteId = cursor.getString(cursor.getColumnIndexOrThrow(Contract.AnalyticBeacon.SITE_ID));
            String playerId = cursor.getString(cursor.getColumnIndexOrThrow(Contract.AnalyticBeacon.PLAYER_ID));
            String device = cursor.getString(cursor.getColumnIndexOrThrow(Contract.AnalyticBeacon.DEVICE));
            if (videoId != null) {
                dimensions.setVideoId(videoId);
            }
            if (siteId != null) {
                dimensions.setSiteId(siteId);
            }
            if (playerId != null) {
                dimensions.setPlayerId(playerId);
            }
            if (device != null) {
                dimensions.setDevice(device);
            }
            result.setDimensions(dimensions);
        }
    }
    return result;
}
Also used : Cursor(android.database.Cursor) AnalyticsDimensions(com.zype.android.webapi.model.player.AnalyticsDimensions) Analytics(com.zype.android.webapi.model.player.Analytics)

Aggregations

Analytics (com.zype.android.webapi.model.player.Analytics)2 AnalyticsDimensions (com.zype.android.webapi.model.player.AnalyticsDimensions)2 Cursor (android.database.Cursor)1 Subscribe (com.squareup.otto.Subscribe)1 Advertising (com.zype.android.webapi.model.player.Advertising)1 AdvertisingSchedule (com.zype.android.webapi.model.player.AdvertisingSchedule)1