Skip to content

Commit

Permalink
Fire App Builder v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
creeld committed Jun 23, 2017
1 parent 75d66dd commit f63b162
Show file tree
Hide file tree
Showing 100 changed files with 9,494 additions and 3,830 deletions.
1 change: 0 additions & 1 deletion AMZNMediaPlayerComponent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/AMZNMediaPlayer.jar')
compile files('libs/exoplayer.jar')
compile project(':ModuleInterface')
compile project(':UAMP')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,38 +379,39 @@ public void enableTextTrack(TrackType trackType, boolean b) {
}

/*
* TODO: Not implemented yet DEVTECH-2280
* {@inheritDoc}
*/
@Override
public int getTrackCount(TrackType trackType) {

return 0;
return mPlayer.getTrackCount(trackType);
}

/*
* TODO: Not implemented yet DEVTECH-2280
* {@inheritDoc}
*/
@Override
public MediaFormat getTrackFormat(TrackType trackType, int i) {

return null;
return mPlayer.getTrackFormat(trackType, i);
}

/*
* TODO: Not implemented yet DEVTECH-2280
* {@inheritDoc}
*/
@Override
public void setSelectedTrack(TrackType trackType, int i) {

mPlayer.setSelectedTrack(trackType, i);
}

/*
* TODO: Not implemented yet DEVTECH-2280
* {@inheritDoc}
*/
@Override
public int getSelectedTrack(TrackType trackType) {

return 0;
return mPlayer.getSelectedTrack(trackType);
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public void onFailure(int statusCode, Header[] headers, String
});
}
else {
bundle.putString(AuthenticationConstants.ERROR_CATEGORY,
AuthenticationConstants.NETWORK_ERROR_CATEGORY);
populateErrorBundle(bundle, AuthenticationConstants.NETWORK_ERROR_CATEGORY);
responseHandler.onFailure(bundle);
}
}
Expand Down Expand Up @@ -201,8 +200,7 @@ public void onFailure(int statusCode, Header[] headers, String
});
}
else {
bundle.putString(AuthenticationConstants.ERROR_CATEGORY,
AuthenticationConstants.NETWORK_ERROR_CATEGORY);
populateErrorBundle(bundle, AuthenticationConstants.NETWORK_ERROR_CATEGORY);
responseHandler.onFailure(bundle);
}

Expand Down Expand Up @@ -267,8 +265,7 @@ public void onFailure(int statusCode, Header[] headers, String
});
}
else {
bundle.putString(AuthenticationConstants.ERROR_CATEGORY,
AuthenticationConstants.NETWORK_ERROR_CATEGORY);
populateErrorBundle(bundle, AuthenticationConstants.NETWORK_ERROR_CATEGORY);
responseHandler.onFailure(bundle);
}
}
Expand All @@ -292,12 +289,15 @@ public void onFailure(int statusCode, Header[] headers, String
private void populateAuthorizationFailureBundle(int statusCode, Bundle bundle, Throwable
throwable) {

bundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
bundle.putString(
Bundle errorBundle = new Bundle();
errorBundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
errorBundle.putString(
AuthenticationConstants.ERROR_CATEGORY,
AuthenticationConstants.AUTHORIZATION_ERROR_CATEGORY);
bundle.putSerializable(
errorBundle.putSerializable(
AuthenticationConstants.ERROR_CAUSE, throwable);
bundle.putBundle(
AuthenticationConstants.ERROR_BUNDLE, errorBundle);
}

/**
Expand All @@ -318,11 +318,30 @@ public void cancelAllRequests() {
private void populateAuthenticationFailureBundle(int statusCode, Bundle bundle, Throwable
throwable) {

bundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
bundle.putString(
Bundle errorBundle = new Bundle();
errorBundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
errorBundle.putString(
AuthenticationConstants.ERROR_CATEGORY,
AuthenticationConstants.AUTHENTICATION_ERROR_CATEGORY);
bundle.putSerializable(
errorBundle.putSerializable(
AuthenticationConstants.ERROR_CAUSE, throwable);
bundle.putBundle(
AuthenticationConstants.ERROR_BUNDLE, errorBundle);
}

/**
* Bundle to be sent on failures other than Authentication and Authorization
*
* @param bundle Bundle to populate
* @param errorCategory Error Category
*/
private void populateErrorBundle(Bundle bundle, String errorCategory) {

Bundle errorBundle = new Bundle();
errorBundle.putString(
AuthenticationConstants.ERROR_CATEGORY,
errorCategory);
bundle.putBundle(
AuthenticationConstants.ERROR_BUNDLE, errorBundle);
}
}
132 changes: 132 additions & 0 deletions AdsInterface/src/main/java/com/amazon/ads/AdMetaData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/**
* Copyright 2015-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazon.ads;

/**
* Class to hold Ad metadata.
*/
public class AdMetaData {

/**
* Ad ID.
*/
private String adId = "";

/**
* Duration of ad played on screen.
*/
private long durationPlayed;

/**
* Duration of ad received in ad meta data.
*/
private long durationReceived;

/**
* Ad Type: Pre roll, Mid roll, Post roll
*/
private String adType = "";

/**
* set id of current ad.
*
* @param adId current ad id received in ad metadata.
*/
public void setAdId(String adId) {

this.adId = adId;
}

/**
* set duration of current ad played on screen.
*
* @param durationPlayed duration of ad played on screen
*/
public void setDurationPlayed(long durationPlayed) {

this.durationPlayed = durationPlayed;
}

/**
* set duration of ad received in ad meta data.
*
* @param durationReceived duration of ad received in ad meta data
*/
public void setDurationReceived(long durationReceived) {

this.durationReceived = durationReceived;
}

/**
* set ad type in ad meta data.
*
* @param adType pre, mid or post roll
*/
public void setAdType(String adType) {

this.adType = adType;
}

/**
* Return the ad Id.
*
* @return id of current ad.
*/
public String getAdId() {

return adId;
}

/**
* Return the duration played of current ad.
*
* @return duration of ad played on screen.
*/
public long getDurationPlayed() {

return durationPlayed;
}

/**
* Return the duration received from ad module.
*
* @return duration of ad as received from ad meta data.
*/
public long getDurationReceived() {

return durationReceived;
}

/**
* Return the ad type.
*
* @return type of current ad.
*/
public String getAdType() {

return adType;
}

@Override
public String toString() {

return "AdMetaData{" +
"adId='" + adId + '\'' +
", durationPlayed=" + durationPlayed +
", durationReceived=" + durationReceived +
", adType='" + adType + '\'' +
'}';
}
}
55 changes: 49 additions & 6 deletions AdsInterface/src/main/java/com/amazon/ads/IAds.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,50 @@
public interface IAds {

/**
* Constant for duration field.
* Constant for Ad Id.
*/
String DURATION = "duration";
String ID = "id";

/**
* Constant for wasAMidRoll field.
* Constant for duration received from ad metadata.
*/
String WAS_A_MID_ROLL = "wasAMidRoll";
String DURATION_RECEIVED = "durationReceived";

/**
* Constant for duration calculated during ad play.
*/
String DURATION_PLAYED = "durationPlayed";

/**
* Constant for getting the ad pod complete boolean out of the extras bundle.
*/
String AD_POD_COMPLETE = "adPodComplete";

/**
* Constant for getting the ad type out of the extras bundle.
*/
String AD_TYPE = "ad_type";

/**
* Constant for a pre-roll ad.
*/
String PRE_ROLL_AD = "preroll";

/**
* Constant for a mid-roll ad.
*/
String MID_ROLL_AD = "midroll";

/**
* Constant for a post-roll ad.
*/
String POST_ROLL_AD = "postroll";

/**
* Parameter to add to an ad tag URL with a timestamp so the add will play consecutively if
* called upon.
*/
String CORRELATOR_PARAMETER = "correlator";

/**
* Major version number.
Expand All @@ -46,8 +82,8 @@ public interface IAds {
/**
* Init Ads instance.
*
* @param context Context which Ads consumed in.
* @param frameLayout Layout for Ads.
* @param context The context.
* @param frameLayout Layout for the Ads player.
* @param extras Extra bundle to pass through data.
*/
void init(Context context, FrameLayout frameLayout, Bundle extras);
Expand Down Expand Up @@ -91,6 +127,13 @@ interface IAdsEvents {
*/
void setCurrentVideoPosition(double position);

/**
* Return true if there are one or more post roll ads to play; false otherwise.
*
* @return True if there are one or more post roll ads to play; false otherwise.
*/
boolean isPostRollAvailable();

/**
* Activity states for ads implementation consumption.
*/
Expand Down
Loading

0 comments on commit f63b162

Please sign in to comment.