Search in sources :

Example 1 with AnalyticsDimensions

use of com.zype.android.webapi.model.player.AnalyticsDimensions 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 'VideoList' 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());
    hideProgress();
}
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 AnalyticsDimensions

use of com.zype.android.webapi.model.player.AnalyticsDimensions 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)

Example 3 with AnalyticsDimensions

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

the class PlayerFragment method attachPlayerToAnalyticsManager.

// 
// Analytics
// 
private void attachPlayerToAnalyticsManager() {
    if (player != null && analytics != null) {
        VideoData video = VideoHelper.getVideo(getActivity().getContentResolver(), fileId);
        if (video == null) {
            return;
        }
        AnalyticsDimensions dimensions = analytics.getDimensions();
        Context context = getActivity().getApplicationContext();
        String beacon = analytics.getBeacon();
        String videoUrl = video.getPlayerVideoUrl();
        Map<String, String> customDimensions = getCustomDimensions(video, dimensions);
        AnalyticsManager manager = AnalyticsManager.getInstance();
        manager.trackPlay(context, player, beacon, videoUrl, customDimensions);
    }
}
Also used : Context(android.content.Context) VideoData(com.zype.android.webapi.model.video.VideoData) AnalyticsDimensions(com.zype.android.webapi.model.player.AnalyticsDimensions)

Aggregations

AnalyticsDimensions (com.zype.android.webapi.model.player.AnalyticsDimensions)3 Analytics (com.zype.android.webapi.model.player.Analytics)2 Context (android.content.Context)1 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 VideoData (com.zype.android.webapi.model.video.VideoData)1