Skip to content

Commit

Permalink
Merge pull request #1 from ooyala/candidate
Browse files Browse the repository at this point in the history
update candidate
  • Loading branch information
sndy35 authored Jun 28, 2018
2 parents 4ca069f + f9bd918 commit c238085
Show file tree
Hide file tree
Showing 91 changed files with 1,695 additions and 768 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package com.ooyala.sample.utils;

import java.lang.ref.WeakReference;
import java.util.Timer;
import java.util.TimerTask;

import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Handler;
import android.os.Message;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

Expand All @@ -23,6 +19,10 @@
import com.ooyala.android.player.exoplayer.PlayerBitmapListener;
import com.ooyala.android.plugin.LifeCycleInterface;

import java.lang.ref.WeakReference;
import java.util.Timer;
import java.util.TimerTask;

public class SampleAdPlayer extends LinearLayout implements PlayerInterface,
LifeCycleInterface {
private final int DURATION = 5000;
Expand Down Expand Up @@ -154,6 +154,11 @@ public void destroy() {
}
}

@Override
public void configurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
}

@Override
public void reset() {
// TODO Auto-generated method stub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Set;

import android.content.Context;
import android.content.res.Configuration;

import com.ooyala.android.AdPodInfo;
import com.ooyala.android.OoyalaPlayer;
Expand Down Expand Up @@ -64,6 +65,11 @@ public void suspend() {
public void suspend(boolean onlyRemoveView) {
}

@Override
public void configurationChanged(Configuration configuration) {

}

@Override
public PlayerInterface getPlayerInterface() {
return _adPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class CastOptionsProvider implements OptionsProvider {
@Override
public CastOptions getCastOptions(Context context) {
NotificationOptions notificationOptions = new NotificationOptions.Builder()
.setTargetActivityClassName(ChromecastPlayerActivity.class.getName())
.setPlayDrawableResId(R.drawable.ic_media_play_light)
.setPauseDrawableResId(R.drawable.ic_media_pause_light)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ private void parseSharedPreferences() {
SharedPreferences lastChoosenParams = getSharedPreferences("LastChoosenParams", MODE_PRIVATE);
if (lastChoosenParams != null) {
embedCode = lastChoosenParams.getString("embedcode", "");
//If second embed code is null - put first embed code as second embed code to let use repeating after playing
secondEmbedCode = lastChoosenParams.getString("secondEmbedCode", embedCode);
secondEmbedCode = lastChoosenParams.getString("secondEmbedCode", null);
pcode = lastChoosenParams.getString("pcode", "");
domain = lastChoosenParams.getString("domain", "");
}
Expand Down
4 changes: 2 additions & 2 deletions CompleteSampleApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ task copyTask(type: Copy) {
from new File(vendorDir, 'Ooyala/OoyalaFreewheelSDK-Android/OoyalaFreewheelSDK.jar')
from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.aar')
from new File(vendorDir, 'Freewheel/Android_AdManagerDistribution/FWAdManager.jar')
from new File(vendorDir, 'Google/ima-android-v374.jar')
from new File(vendorDir, 'Google/ima-android-v385.jar')
from new File(vendorDir, 'NPAW/YouboraLib-5.3.1.jar')
from new File(vendorDir, 'NPAW/YouboraPluginOoyala-5.3.0.jar')
from new File(vendorDir, 'AdobePass/android_accessenabler-1.7.3.jar')
Expand Down Expand Up @@ -54,7 +54,7 @@ dependencies {
implementation files('libs/OoyalaIMASDK.jar')
implementation files('libs/OoyalaSDK.aar')
implementation files('libs/OoyalaSkinSDK.aar')
implementation files('libs/ima-android-v374.jar')
implementation files('libs/ima-android-v385.jar')
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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.TimerTask;

import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Handler;
import android.os.Message;
Expand Down Expand Up @@ -158,6 +159,11 @@ public void destroy() {
}
}

@Override
public void configurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
}

@Override
public void reset() {
// TODO Auto-generated method stub
Expand Down
4 changes: 1 addition & 3 deletions ContentProtectionSampleApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ task copyTask(type: Copy) {
tasks.copyTask.execute()

dependencies {

implementation 'com.google.code.gson:gson:2.2.2'
implementation 'com.google.android.gms:play-services-ads:12.0.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.exoplayer:exoplayer:2.6.1'
implementation files('libs/android_accessenabler-1.7.3.jar')
implementation files('libs/OoyalaSDK.aar')

}

repositories {
google()
}
}
13 changes: 11 additions & 2 deletions ContentProtectionSampleApp/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,22 @@
android:theme="@style/Theme.AppCompat">
<service android:name="com.adobe.adobepass.accessenabler.api.AccessEnablerService"
android:label="AccessEnabler service"/>



<activity
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden|screenSize"
android:name=".lists.ContentProtectionListActivity" >
android:name="com.ooyala.sample.complete.MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".lists.ContentProtectionListActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
</activity>
<activity
android:configChanges="orientation|keyboardHidden|screenSize"
android:name=".players.AdobePassSampleAppAcitivity" >
Expand All @@ -35,6 +40,10 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:name=".players.OoyalaPlayerTokenPlayerActivity" >
</activity>
<activity
android:configChanges="orientation|keyboardHidden|screenSize"
android:name=".players.CustomActivity" >
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.ooyala.sample.complete;

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.lists.ContentProtectionListActivity;

import com.ooyala.sample.players.CustomActivity;


import java.util.LinkedHashMap;
import java.util.Map;

/**
* This is the opening activity for the app.
*
*
*/
public class MainActivity extends Activity implements OnItemClickListener {
final String TAG = this.getClass().toString();

private static Map<String, Class<? extends Activity>> activityMap;
ArrayAdapter<String> mainListAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_activity_layout);
activityMap = new LinkedHashMap<String, Class<? extends Activity>>();
mainListAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item);
activityMap.put(ContentProtectionListActivity.getName(), ContentProtectionListActivity.class);
activityMap.put(CustomActivity.getName(), CustomActivity.class);
for(String key : activityMap.keySet()) {
mainListAdapter.add(key);
}
mainListAdapter.notifyDataSetChanged();
ListView mainListView = (ListView) findViewById(R.id.mainActivityListView);
mainListView.setAdapter(mainListAdapter);
mainListView.setOnItemClickListener(this);
}

@Override
public void onItemClick(AdapterView<?> l, View v, int pos, long id) {
Class<? extends Activity> selectedClass = activityMap.get(mainListAdapter.getItem(pos));
Intent intent = new Intent(this, selectedClass);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
return;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.ooyala.sample.players;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.ooyala.sample.R;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class CustomActivity extends Activity {
public static String getName() {
return "Asset Options";
}
private EditText embedCodeEditText;
private EditText pCodeEditText;
private EditText apiKeyEditText;
private EditText secretEditText;
private EditText accountIdEditText;
private String embedCode;
private String pCode;
private String apiKey;
private String secret;
private String accountId;
private CheckBox autoPlayCheckBox;
private boolean autoPlay;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.embed_pcode_layout);
embedCodeEditText = findViewById(R.id.embed_edit_text);
pCodeEditText = findViewById(R.id.pcode_edit_text);
apiKeyEditText = findViewById(R.id.apikey_edit_text);
secretEditText = findViewById(R.id.secret_edit_text);
accountIdEditText = findViewById(R.id.accountid_edit_text);
autoPlayCheckBox = findViewById(R.id.auto_play_check_box);
initButtonListeners();
}

private void initButtonListeners() {
Button setAssetButton = findViewById(R.id.play_button);
setAssetButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
embedCode = embedCodeEditText.getText().toString();
pCode = pCodeEditText.getText().toString();
apiKey = apiKeyEditText.getText().toString();
secret = secretEditText.getText().toString();
accountId = accountIdEditText.getText().toString();
autoPlay = autoPlayCheckBox.isChecked() ? true : false;
if (embedCode.isEmpty()) {
Toast.makeText(CustomActivity.this, "Embed code can't be empty!", Toast.LENGTH_LONG).show();
return;
}
if (pCode.isEmpty()) {
Toast.makeText(CustomActivity.this, "PCode can't be empty!", Toast.LENGTH_LONG).show();
return;
}
startPlayerActivity();
}
});
}


private void startPlayerActivity() {
//PlayerActivity map
//Launch the correct activity
Intent intent = new Intent(this, OoyalaPlayerTokenPlayerActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra("embed_code", embedCode);
intent.putExtra("pcode", pCode);
intent.putExtra("domain", "http://www.ooyala.com");
intent.putExtra("autoPlay", autoPlay);
intent.putExtra("apikey", apiKey);
intent.putExtra("secret", secret);
intent.putExtra("accountid", accountId);
startActivity(intent);
}
}
Loading

0 comments on commit c238085

Please sign in to comment.