-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PLAYER-4682_Two new activities for NPAW-FW and NPAW-IMA #386
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,6 @@ dependencies { | |
implementation files('libs/android_accessenabler-1.7.3.jar') | ||
implementation files('libs/YouboraLib-5.3.1.jar') | ||
implementation files('libs/YouboraPluginOoyala-5.3.0.jar') | ||
compile files('libs/YouboraLib-5.3.1.jar') | ||
compile files('libs/YouboraPluginOoyala-5.3.0.jar') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "compile" is obsolete, please use "implementation" or "api" |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,20 @@ | |
<activity android:name=".players.ProgrammaticVolumePlayerActivity" | ||
android:configChanges="keyboardHidden|orientation|screenSize"> | ||
</activity> | ||
<activity | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO, activities should be formatted like that: <activity
android:name="com.ooyala.sample.lists.NPAWFreewheelListActivity"
android:configChanges="keyboardHidden|orientation|screenSize" /> |
||
android:name="com.ooyala.sample.lists.NPAWFreewheelListActivity" | ||
android:configChanges="keyboardHidden|orientation|screenSize" > | ||
</activity> | ||
<activity android:name="com.ooyala.sample.players.NPAWPreconfiguredFreewheelPlayerActivity" | ||
android:configChanges="keyboardHidden|orientation|screenSize"> | ||
</activity> | ||
<activity | ||
android:name="com.ooyala.sample.lists.NPAWIMAListActivity" | ||
android:configChanges="keyboardHidden|orientation|screenSize"> | ||
</activity> | ||
<activity android:name="com.ooyala.sample.players.NPAWPreconfiguredIMAPlayerActivity" | ||
android:configChanges="keyboardHidden|orientation|screenSize"> | ||
</activity> | ||
|
||
<meta-data | ||
android:name="com.google.android.gms.version" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.ooyala.sample.lists; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.AdapterView; | ||
import android.widget.AdapterView.OnItemClickListener; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.ListView; | ||
|
||
import com.ooyala.sample.R; | ||
import com.ooyala.sample.players.CustomConfiguredFreewheelPlayerActivity; | ||
import com.ooyala.sample.players.OptionsFreewheelPlayerActivity; | ||
import com.ooyala.sample.players.NPAWPreconfiguredFreewheelPlayerActivity; | ||
import com.ooyala.sample.utils.PlayerSelectionOption; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class NPAWFreewheelListActivity extends Activity implements OnItemClickListener { | ||
public final static String getName() { | ||
return "NPAW Freewheel Integration"; | ||
} | ||
|
||
private static Map<String, PlayerSelectionOption> selectionMap; | ||
ArrayAdapter<String> selectionAdapter; | ||
|
||
/** | ||
* Called when the activity is first created. | ||
*/ | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setTitle(getName()); | ||
|
||
selectionMap = new LinkedHashMap<String, PlayerSelectionOption>(); | ||
//Populate the embed map | ||
selectionMap.put("Freewheel Preroll", new PlayerSelectionOption("Q5MXg2bzq0UAXXMjLIFWio_6U0Jcfk6v", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", NPAWPreconfiguredFreewheelPlayerActivity.class) ); | ||
selectionMap.put("Freewheel Midroll", new PlayerSelectionOption("NwcGg4bzrwxc6rqAZbYij4pWivBsX57a", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", NPAWPreconfiguredFreewheelPlayerActivity.class) ); | ||
selectionMap.put("Freewheel Postroll", new PlayerSelectionOption("NmcGg4bzqbeqXO_x9Rfj5IX6gwmRRrse", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", NPAWPreconfiguredFreewheelPlayerActivity.class) ); | ||
selectionMap.put("Freewheel PreMidPost", new PlayerSelectionOption("NqcGg4bzoOmMiV35ZttQDtBX1oNQBnT-", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", NPAWPreconfiguredFreewheelPlayerActivity.class) ); | ||
selectionMap.put("Freewheel Overlay", new PlayerSelectionOption("NucGg4bzrVrilZrMdlSA9tyg6Vty46DN", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", NPAWPreconfiguredFreewheelPlayerActivity.class) ); | ||
selectionMap.put("Freewheel Multi Midroll", new PlayerSelectionOption("htdnB3cDpMzXVL7fecaIWdv9rTd125As", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", NPAWPreconfiguredFreewheelPlayerActivity.class) ); | ||
selectionMap.put("Freewheel PreMidPost Overlay", new PlayerSelectionOption("NscGg4bzpO9s5rUMyW-AAfoeEA7CX6hP", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", NPAWPreconfiguredFreewheelPlayerActivity.class) ); | ||
|
||
selectionMap.put("Freewheel Application-Configured", new PlayerSelectionOption("Q5MXg2bzq0UAXXMjLIFWio_6U0Jcfk6v", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", CustomConfiguredFreewheelPlayerActivity.class) ); | ||
selectionMap.put("CuePoints and AdsControl Options", new PlayerSelectionOption("NqcGg4bzoOmMiV35ZttQDtBX1oNQBnT-", "V0NDYyOuL4a4eLle69su0dP_7vs1", "http://www.ooyala.com", OptionsFreewheelPlayerActivity.class)); | ||
|
||
setContentView(R.layout.list_activity_layout_npaw_fw); | ||
|
||
//Create the adapter for the ListView | ||
selectionAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item); | ||
for(String key : selectionMap.keySet()) { | ||
selectionAdapter.add(key); | ||
} | ||
selectionAdapter.notifyDataSetChanged(); | ||
|
||
//Load the data into the ListView | ||
ListView selectionListView = (ListView) findViewById(R.id.mainActivityListView); | ||
selectionListView.setAdapter(selectionAdapter); | ||
selectionListView.setOnItemClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onItemClick(AdapterView<?> l, View v, int pos, long id) { | ||
PlayerSelectionOption selection = selectionMap.get(selectionAdapter.getItem(pos)); | ||
Class<? extends Activity> selectedClass = selection.getActivity(); | ||
|
||
//Launch the correct activity with the embed code as an extra | ||
Intent intent = new Intent(this, selectedClass); | ||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||
intent.putExtra("embed_code", selection.getEmbedCode()); | ||
intent.putExtra("pcode", selection.getPcode()); | ||
intent.putExtra("domain", selection.getDomain()); | ||
startActivity(intent); | ||
return; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.ooyala.sample.lists; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.AdapterView; | ||
import android.widget.AdapterView.OnItemClickListener; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.ListView; | ||
|
||
import com.ooyala.sample.R; | ||
import com.ooyala.sample.players.CustomConfiguredIMAPlayerActivity; | ||
import com.ooyala.sample.players.NPAWPreconfiguredIMAPlayerActivity; | ||
import com.ooyala.sample.players.PreconfiguredIMAPlayerActivity; | ||
import com.ooyala.sample.utils.PlayerSelectionOption; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class NPAWIMAListActivity extends Activity implements OnItemClickListener { | ||
public final static String getName() { | ||
return "NPAW Google IMA Integration"; | ||
} | ||
|
||
private static Map<String, PlayerSelectionOption> selectionMap; | ||
ArrayAdapter<String> selectionAdapter; | ||
|
||
/** | ||
* Called when the activity is first created. | ||
*/ | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setTitle(getName()); | ||
|
||
selectionMap = new LinkedHashMap<String, PlayerSelectionOption>(); | ||
//Populate the embed map | ||
//TODO: Change the IMA Ad-Rules Preroll embed code, the current one is malformed | ||
// selectionMap.put("IMA Ad-Rules Preroll", new PlayerSelectionOption("EzZ29lcTq49IswgZYkMknnU4Ukb9PQMH", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", PreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Ad-Rules Midroll", new PlayerSelectionOption("VlaG9lcTqeUU18adfd1DVeQ8YekP3H4l", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Ad-Rules Postroll", new PlayerSelectionOption("BnaG9lcTqLXQNyod7ON8Yv3eDas2Oog6", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Podded Preroll", new PlayerSelectionOption("1wNjE3cDox0G3hQIWxTjsZ8MPUDLSkDY", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Podded Midroll", new PlayerSelectionOption("1yNjE3cDodUEfUfp2WNzHkCZCMb47MUP", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Podded Postroll", new PlayerSelectionOption("1sNjE3cDoN3ZewFm1238ce730J4BMrEJ", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Podded Pre-Mid-Post", new PlayerSelectionOption("ZrOTE3cDoXo2sLOWzQPxjS__M-Qk32Co", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Skippable", new PlayerSelectionOption("FhbGRjbzq8tfaoA3dhfxc2Qs0-RURJfO", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Pre, Mid and Post Skippable", new PlayerSelectionOption("10NjE3cDpj8nUzYiV1PnFsjC6nEvPQAE", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Application-Configured", new PlayerSelectionOption("Y1ZHB1ZDqfhCPjYYRbCEOz0GR8IsVRm1", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", CustomConfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Non Ad-Rules Preroll", new PlayerSelectionOption("FlbGRjbzptyEbStMiMLcyNQE6l6TMgwq", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Non Ad-Rules Midroll", new PlayerSelectionOption("xrbGRjbzoBJUwtSLOHrcceTvMBe5pZdN", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Non Ad-Rules Postroll", new PlayerSelectionOption("FjbGRjbzp0DV_5-NtXBVo5Rgp3Sj0R5C", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Non Ad-Rules Quad Midroll", new PlayerSelectionOption("J3bHFpNTE6E2o2Fx_kZMyusc6m8SENCe", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("IMA Non Ad-Rules Pre-Mid-Mid-Post", new PlayerSelectionOption("g0d3BpNTE6GTTPK7o4ZyIcGqc878DqJ6", "R2NDYyOhSRhYj0UrUVgcdWlFVP-H", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
selectionMap.put("No Ads", new PlayerSelectionOption("JiOTdrdzqAujYa5qvnOxszbrTEuU5HMt", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", NPAWPreconfiguredIMAPlayerActivity.class) ); | ||
|
||
setContentView(com.ooyala.sample.R.layout.list_activity_layout_npaw_ima); | ||
|
||
//Create the adapter for the ListView | ||
selectionAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item); | ||
for(String key : selectionMap.keySet()) { | ||
selectionAdapter.add(key); | ||
} | ||
selectionAdapter.notifyDataSetChanged(); | ||
|
||
//Load the data into the ListView | ||
ListView selectionListView = (ListView) findViewById(R.id.mainActivityListView); | ||
selectionListView.setAdapter(selectionAdapter); | ||
selectionListView.setOnItemClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onItemClick(AdapterView<?> l, View v, int pos, long id) { | ||
PlayerSelectionOption selection = selectionMap.get(selectionAdapter.getItem(pos)); | ||
Class<? extends Activity> selectedClass = selection.getActivity(); | ||
|
||
//Launch the correct activity with the embed code as an extra | ||
Intent intent = new Intent(this, selectedClass); | ||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||
intent.putExtra("embed_code", selection.getEmbedCode()); | ||
intent.putExtra("pcode", selection.getPcode()); | ||
intent.putExtra("domain", selection.getDomain()); | ||
startActivity(intent); | ||
return; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.ooyala.sample.players; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.ActivityCompat; | ||
import android.support.v4.content.ContextCompat; | ||
import android.util.Log; | ||
|
||
import com.ooyala.android.OoyalaNotification; | ||
import com.ooyala.android.OoyalaPlayer; | ||
import com.ooyala.android.util.SDCardLogcatOoyalaEventsLogger; | ||
|
||
import java.util.Observable; | ||
import java.util.Observer; | ||
|
||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE; | ||
import static android.content.pm.PackageManager.PERMISSION_GRANTED; | ||
|
||
/** | ||
* This class asks permission for WRITE_EXTERNAL_STORAGE. We need it for automation hooks | ||
* as we need to write into the SD card and automation will parse this file. | ||
*/ | ||
public abstract class NPAWFWAbstractHookActivity extends Activity implements Observer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation is broken in this file. We use 2 spaces. |
||
private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1; | ||
String TAG = this.getClass().toString(); | ||
|
||
SDCardLogcatOoyalaEventsLogger log = new SDCardLogcatOoyalaEventsLogger(); | ||
|
||
String embedCode; | ||
String pcode; | ||
String domain; | ||
|
||
OoyalaPlayer player; | ||
|
||
boolean writePermission = false; | ||
boolean asked = false; | ||
|
||
// complete player setup after we asked for permission to write into external storage | ||
abstract void completePlayerSetup(final boolean asked); | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { | ||
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); | ||
} else { | ||
writePermission= true; | ||
asked = true; | ||
} | ||
|
||
embedCode = getIntent().getExtras().getString("embed_code"); | ||
pcode = getIntent().getExtras().getString("pcode"); | ||
domain = getIntent().getExtras().getString("domain"); | ||
} | ||
|
||
@Override | ||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
if (requestCode == PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE) { | ||
asked = true; | ||
if (grantResults.length > 0 && grantResults[0] == PERMISSION_GRANTED) { | ||
writePermission = true; | ||
} | ||
completePlayerSetup(asked); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
super.onPause(); | ||
if (null != player) { | ||
player.suspend(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
if (null != player) { | ||
player.resume(); | ||
} | ||
} | ||
|
||
@Override | ||
public void update(Observable o, Object arg) { | ||
final String arg1 = OoyalaNotification.getNameOrUnknown(arg); | ||
if (arg1.equals(OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME)) { | ||
return; | ||
} | ||
|
||
String text = "Notification Received: " + arg1 + " - state: " + player.getState(); | ||
Log.d(TAG, text); | ||
|
||
if (writePermission) { | ||
Log.d(TAG, "Writing log to SD card"); | ||
// Automation Hook: Write the event text along with event count to log file in sdcard if the log file exists | ||
log.writeToSdcardLog(text); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, are versions of YouboraLib and YouboraPluginOoyala ahve to be the same (5.3.1)?