Skip to content

Commit f63b162

Browse files
committed
Fire App Builder v1.0.5
1 parent 75d66dd commit f63b162

File tree

100 files changed

+9494
-3830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+9494
-3830
lines changed

AMZNMediaPlayerComponent/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ dependencies {
5050
compile fileTree(dir: 'libs', include: ['*.jar'])
5151
compile 'com.android.support:appcompat-v7:23.1.1'
5252
compile files('libs/AMZNMediaPlayer.jar')
53-
compile files('libs/exoplayer.jar')
5453
compile project(':ModuleInterface')
5554
compile project(':UAMP')
5655

AMZNMediaPlayerComponent/src/main/java/com/amazon/mediaplayer/glue/AMZNPlayer.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,38 +379,39 @@ public void enableTextTrack(TrackType trackType, boolean b) {
379379
}
380380

381381
/*
382-
* TODO: Not implemented yet DEVTECH-2280
382+
* {@inheritDoc}
383383
*/
384384
@Override
385385
public int getTrackCount(TrackType trackType) {
386386

387-
return 0;
387+
return mPlayer.getTrackCount(trackType);
388388
}
389389

390390
/*
391-
* TODO: Not implemented yet DEVTECH-2280
391+
* {@inheritDoc}
392392
*/
393393
@Override
394394
public MediaFormat getTrackFormat(TrackType trackType, int i) {
395395

396-
return null;
396+
return mPlayer.getTrackFormat(trackType, i);
397397
}
398398

399399
/*
400-
* TODO: Not implemented yet DEVTECH-2280
400+
* {@inheritDoc}
401401
*/
402402
@Override
403403
public void setSelectedTrack(TrackType trackType, int i) {
404404

405+
mPlayer.setSelectedTrack(trackType, i);
405406
}
406407

407408
/*
408-
* TODO: Not implemented yet DEVTECH-2280
409+
* {@inheritDoc}
409410
*/
410411
@Override
411412
public int getSelectedTrack(TrackType trackType) {
412413

413-
return 0;
414+
return mPlayer.getSelectedTrack(trackType);
414415
}
415416

416417
/*

AdobepassAuthComponent/src/main/java/com/amazon/adobepass/auth/AdobepassAuthentication.java

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ public void onFailure(int statusCode, Header[] headers, String
126126
});
127127
}
128128
else {
129-
bundle.putString(AuthenticationConstants.ERROR_CATEGORY,
130-
AuthenticationConstants.NETWORK_ERROR_CATEGORY);
129+
populateErrorBundle(bundle, AuthenticationConstants.NETWORK_ERROR_CATEGORY);
131130
responseHandler.onFailure(bundle);
132131
}
133132
}
@@ -201,8 +200,7 @@ public void onFailure(int statusCode, Header[] headers, String
201200
});
202201
}
203202
else {
204-
bundle.putString(AuthenticationConstants.ERROR_CATEGORY,
205-
AuthenticationConstants.NETWORK_ERROR_CATEGORY);
203+
populateErrorBundle(bundle, AuthenticationConstants.NETWORK_ERROR_CATEGORY);
206204
responseHandler.onFailure(bundle);
207205
}
208206

@@ -267,8 +265,7 @@ public void onFailure(int statusCode, Header[] headers, String
267265
});
268266
}
269267
else {
270-
bundle.putString(AuthenticationConstants.ERROR_CATEGORY,
271-
AuthenticationConstants.NETWORK_ERROR_CATEGORY);
268+
populateErrorBundle(bundle, AuthenticationConstants.NETWORK_ERROR_CATEGORY);
272269
responseHandler.onFailure(bundle);
273270
}
274271
}
@@ -292,12 +289,15 @@ public void onFailure(int statusCode, Header[] headers, String
292289
private void populateAuthorizationFailureBundle(int statusCode, Bundle bundle, Throwable
293290
throwable) {
294291

295-
bundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
296-
bundle.putString(
292+
Bundle errorBundle = new Bundle();
293+
errorBundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
294+
errorBundle.putString(
297295
AuthenticationConstants.ERROR_CATEGORY,
298296
AuthenticationConstants.AUTHORIZATION_ERROR_CATEGORY);
299-
bundle.putSerializable(
297+
errorBundle.putSerializable(
300298
AuthenticationConstants.ERROR_CAUSE, throwable);
299+
bundle.putBundle(
300+
AuthenticationConstants.ERROR_BUNDLE, errorBundle);
301301
}
302302

303303
/**
@@ -318,11 +318,30 @@ public void cancelAllRequests() {
318318
private void populateAuthenticationFailureBundle(int statusCode, Bundle bundle, Throwable
319319
throwable) {
320320

321-
bundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
322-
bundle.putString(
321+
Bundle errorBundle = new Bundle();
322+
errorBundle.putInt(ResponseHandler.STATUS_CODE, statusCode);
323+
errorBundle.putString(
323324
AuthenticationConstants.ERROR_CATEGORY,
324325
AuthenticationConstants.AUTHENTICATION_ERROR_CATEGORY);
325-
bundle.putSerializable(
326+
errorBundle.putSerializable(
326327
AuthenticationConstants.ERROR_CAUSE, throwable);
328+
bundle.putBundle(
329+
AuthenticationConstants.ERROR_BUNDLE, errorBundle);
330+
}
331+
332+
/**
333+
* Bundle to be sent on failures other than Authentication and Authorization
334+
*
335+
* @param bundle Bundle to populate
336+
* @param errorCategory Error Category
337+
*/
338+
private void populateErrorBundle(Bundle bundle, String errorCategory) {
339+
340+
Bundle errorBundle = new Bundle();
341+
errorBundle.putString(
342+
AuthenticationConstants.ERROR_CATEGORY,
343+
errorCategory);
344+
bundle.putBundle(
345+
AuthenticationConstants.ERROR_BUNDLE, errorBundle);
327346
}
328347
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/**
2+
* Copyright 2015-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0/
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
package com.amazon.ads;
16+
17+
/**
18+
* Class to hold Ad metadata.
19+
*/
20+
public class AdMetaData {
21+
22+
/**
23+
* Ad ID.
24+
*/
25+
private String adId = "";
26+
27+
/**
28+
* Duration of ad played on screen.
29+
*/
30+
private long durationPlayed;
31+
32+
/**
33+
* Duration of ad received in ad meta data.
34+
*/
35+
private long durationReceived;
36+
37+
/**
38+
* Ad Type: Pre roll, Mid roll, Post roll
39+
*/
40+
private String adType = "";
41+
42+
/**
43+
* set id of current ad.
44+
*
45+
* @param adId current ad id received in ad metadata.
46+
*/
47+
public void setAdId(String adId) {
48+
49+
this.adId = adId;
50+
}
51+
52+
/**
53+
* set duration of current ad played on screen.
54+
*
55+
* @param durationPlayed duration of ad played on screen
56+
*/
57+
public void setDurationPlayed(long durationPlayed) {
58+
59+
this.durationPlayed = durationPlayed;
60+
}
61+
62+
/**
63+
* set duration of ad received in ad meta data.
64+
*
65+
* @param durationReceived duration of ad received in ad meta data
66+
*/
67+
public void setDurationReceived(long durationReceived) {
68+
69+
this.durationReceived = durationReceived;
70+
}
71+
72+
/**
73+
* set ad type in ad meta data.
74+
*
75+
* @param adType pre, mid or post roll
76+
*/
77+
public void setAdType(String adType) {
78+
79+
this.adType = adType;
80+
}
81+
82+
/**
83+
* Return the ad Id.
84+
*
85+
* @return id of current ad.
86+
*/
87+
public String getAdId() {
88+
89+
return adId;
90+
}
91+
92+
/**
93+
* Return the duration played of current ad.
94+
*
95+
* @return duration of ad played on screen.
96+
*/
97+
public long getDurationPlayed() {
98+
99+
return durationPlayed;
100+
}
101+
102+
/**
103+
* Return the duration received from ad module.
104+
*
105+
* @return duration of ad as received from ad meta data.
106+
*/
107+
public long getDurationReceived() {
108+
109+
return durationReceived;
110+
}
111+
112+
/**
113+
* Return the ad type.
114+
*
115+
* @return type of current ad.
116+
*/
117+
public String getAdType() {
118+
119+
return adType;
120+
}
121+
122+
@Override
123+
public String toString() {
124+
125+
return "AdMetaData{" +
126+
"adId='" + adId + '\'' +
127+
", durationPlayed=" + durationPlayed +
128+
", durationReceived=" + durationReceived +
129+
", adType='" + adType + '\'' +
130+
'}';
131+
}
132+
}

AdsInterface/src/main/java/com/amazon/ads/IAds.java

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,50 @@
2424
public interface IAds {
2525

2626
/**
27-
* Constant for duration field.
27+
* Constant for Ad Id.
2828
*/
29-
String DURATION = "duration";
29+
String ID = "id";
3030

3131
/**
32-
* Constant for wasAMidRoll field.
32+
* Constant for duration received from ad metadata.
3333
*/
34-
String WAS_A_MID_ROLL = "wasAMidRoll";
34+
String DURATION_RECEIVED = "durationReceived";
35+
36+
/**
37+
* Constant for duration calculated during ad play.
38+
*/
39+
String DURATION_PLAYED = "durationPlayed";
40+
41+
/**
42+
* Constant for getting the ad pod complete boolean out of the extras bundle.
43+
*/
44+
String AD_POD_COMPLETE = "adPodComplete";
45+
46+
/**
47+
* Constant for getting the ad type out of the extras bundle.
48+
*/
49+
String AD_TYPE = "ad_type";
50+
51+
/**
52+
* Constant for a pre-roll ad.
53+
*/
54+
String PRE_ROLL_AD = "preroll";
55+
56+
/**
57+
* Constant for a mid-roll ad.
58+
*/
59+
String MID_ROLL_AD = "midroll";
60+
61+
/**
62+
* Constant for a post-roll ad.
63+
*/
64+
String POST_ROLL_AD = "postroll";
65+
66+
/**
67+
* Parameter to add to an ad tag URL with a timestamp so the add will play consecutively if
68+
* called upon.
69+
*/
70+
String CORRELATOR_PARAMETER = "correlator";
3571

3672
/**
3773
* Major version number.
@@ -46,8 +82,8 @@ public interface IAds {
4682
/**
4783
* Init Ads instance.
4884
*
49-
* @param context Context which Ads consumed in.
50-
* @param frameLayout Layout for Ads.
85+
* @param context The context.
86+
* @param frameLayout Layout for the Ads player.
5187
* @param extras Extra bundle to pass through data.
5288
*/
5389
void init(Context context, FrameLayout frameLayout, Bundle extras);
@@ -91,6 +127,13 @@ interface IAdsEvents {
91127
*/
92128
void setCurrentVideoPosition(double position);
93129

130+
/**
131+
* Return true if there are one or more post roll ads to play; false otherwise.
132+
*
133+
* @return True if there are one or more post roll ads to play; false otherwise.
134+
*/
135+
boolean isPostRollAvailable();
136+
94137
/**
95138
* Activity states for ads implementation consumption.
96139
*/

0 commit comments

Comments
 (0)