Skip to content
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

Skinappchanges #380

Open
wants to merge 6 commits into
base: candidate
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ private void startPlayerActivity() {
intent.putExtra("apikey", apiKey);
intent.putExtra("secret", secret);
intent.putExtra("accountid", accountId);
startActivity(intent);
startActivityForResult(intent,1);
isheftel-ooyala marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ public void onCreate(Bundle 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;
writePermission = true;
}
setTitle(getIntent().getExtras().getString("selection_name"));
setContentView(R.layout.player_simple_layout);
EMBED = getIntent().getExtras().getString("embed_code");
PCODE = getIntent().getExtras().getString("pcode");
DOMAIN = getIntent().getExtras().getString("domain");
if(getIntent().getExtras().getClass().getSimpleName().equalsIgnoreCase("CustomActivity")) {
if(getCallingActivity().getClassName().contains("CustomActivity")) {
APIKEY = getIntent().getExtras().getString("apikey");
SECRET = getIntent().getExtras().getString("secret");
ACCOUNT_ID = getIntent().getExtras().getString("accountid");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public abstract class AbstractHookActivity extends Activity implements Observer,
protected String embedCode;
protected String pcode;
protected String domain;
protected String apiKey;
protected String secret;
protected String accountId;
protected String selectedFormat;
protected String hevcMode;
protected boolean isStaging;
Expand Down Expand Up @@ -68,6 +71,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
pcode = extras.getString("pcode");
domain = extras.getString("domain");
autoPlay = extras.getBoolean("autoPlay",false);
apiKey = extras.getString("apiKey");
secret = extras.getString("secret");
accountId = extras.getString("accountId");
selectedFormat = extras.getString("selectedFormat","default");
hevcMode = extras.getString("hevc_mode","NoPreference");
isStaging = extras.getBoolean("is_staging",false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ public static String getName() {
}
private EditText embedCodeEditText;
private EditText pCodeEditText;
private EditText apiKeyEditText;
private EditText secretEditText;
private EditText accountIdEditText;
private Spinner playerSpinner;
private Spinner formatSpinner;
private String embedCode;
private String pCode;
private String secret;
private String apiKey;
private String accountId;
private String playerActivity;
private CheckBox autoPlayCheckBox;
private String selectedFormat;
Expand All @@ -48,6 +54,9 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.embed_pcode_layout);
addItemsOnSpinner();
embedCodeEditText = (EditText) findViewById(R.id.embed_edit_text);
apiKeyEditText = (EditText) findViewById(R.id.apikey_edit_text);
secretEditText = (EditText) findViewById(R.id.secret_edit_text);
accountIdEditText = (EditText) findViewById(R.id.accountId_edit_text);
pCodeEditText = (EditText) findViewById(R.id.pcode_edit_text);
autoPlayCheckBox = (CheckBox) findViewById(R.id.auto_play_check_box);
envStgCheckBox = (CheckBox) findViewById(R.id.set_env_stg);
Expand All @@ -61,6 +70,9 @@ private void initButtonListeners() {
public void onClick(View v) {
embedCode = embedCodeEditText.getText().toString();
pCode = pCodeEditText.getText().toString();
secret = secretEditText.getText().toString();
apiKey = apiKeyEditText.getText().toString();
accountId = accountIdEditText.getText().toString();
playerActivity = String.valueOf(playerSpinner.getSelectedItem());
selectedFormat = String.valueOf(formatSpinner.getSelectedItem());
if (embedCode.isEmpty()) {
Expand All @@ -81,6 +93,7 @@ private void addItemsOnSpinner() {
list.add("OoyalaDefault");
list.add("GoogleIMA");
list.add("Freewheel");
list.add("Geoblocking");
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, list);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Expand Down Expand Up @@ -117,14 +130,17 @@ private void startPlayerActivity() {
pActivity.put("OoyalaDefault",OoyalaSkinPlayerActivity.class);
pActivity.put("GoogleIMA",PreconfiguredIMAPlayerActivity.class);
pActivity.put("Freewheel",PreconfiguredFreewheelPlayerActivity.class);

pActivity.put("Geoblocking",GeoBlockingActivity.class);
//Launch the correct activity
Intent intent = new Intent(this, pActivity.get(playerActivity));
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", autoPlayCheckBox.isChecked() ? true : false);
intent.putExtra("secret", secret);
intent.putExtra("apiKey", apiKey);
intent.putExtra("accountId", accountId);
intent.putExtra("selectedFormat", selectedFormat);
intent.putExtra("hevc_mode", String.valueOf(hevcSpinner.getSelectedItem()));
intent.putExtra("is_staging", envStgCheckBox.isChecked() ? true : false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.ooyala.android.skin.OoyalaSkinLayoutController;
import com.ooyala.android.skin.configuration.SkinOptions;
import com.ooyala.sample.R;
import com.ooyala.sample.utils.CustomPlayerInfo;

import org.json.JSONObject;

Expand All @@ -23,14 +24,14 @@
import java.util.List;

public class GeoBlockingActivity extends AbstractHookActivity implements EmbedTokenGenerator {
private final String ACCOUNT_ID = "";
private String ACCOUNT_ID = "";

/*
* The API Key and Secret should not be saved inside your applciation (even in git!).
* However, for debugging you can use them to locally generate Ooyala Player Tokens.
*/
private final String APIKEY = "";
private final String SECRET = "";
private String APIKEY = "";
private String SECRET = "";

@Override
public void onCreate(Bundle savedInstanceState) {
Expand All @@ -46,9 +47,30 @@ void completePlayerSetup(boolean asked) {
skinLayout = (OoyalaSkinLayout) findViewById(R.id.ooyalaSkin);
// Create the OoyalaPlayer, with some built-in UI disabled
PlayerDomain playerDomain = new PlayerDomain(domain);
Options options = new Options.Builder().setShowNativeLearnMoreButton(false).setShowPromoImage(false).setUseExoPlayer(true).build();
Options options = null;
if(selectedFormat.equalsIgnoreCase("default"))
options = new Options.Builder().setShowNativeLearnMoreButton(false).setShowPromoImage(false).setUseExoPlayer(true).build();
else
options = new Options.Builder().setShowNativeLearnMoreButton(false).setShowPromoImage(false).setUseExoPlayer(true).setPlayerInfo(new CustomPlayerInfo(selectedFormat)).build();

isheftel-ooyala marked this conversation as resolved.
Show resolved Hide resolved
//Uncomment next line if you work on STAGING
//OoyalaPlayer.setEnvironment(Environment.EnvironmentType.STAGING);

if(getCallingActivity().getClassName().contains("AddAssetActivity")) {
ACCOUNT_ID = accountId;
APIKEY = apiKey;
SECRET = secret;
}

//Uncomment next line if you work on STAGING
//OoyalaPlayer.setEnvironment(Environment.EnvironmentType.STAGING);

if(isStaging) {
Log.i(TAG, "Environment Set to Staging:");
OoyalaPlayer.setEnvironment(Environment.EnvironmentType.STAGING, Environment.PROTOCOL_HTTPS);
} else {
OoyalaPlayer.setEnvironment(Environment.EnvironmentType.PRODUCTION, Environment.PROTOCOL_HTTPS);
isheftel-ooyala marked this conversation as resolved.
Show resolved Hide resolved
}
player = new OoyalaPlayer(pcode, playerDomain,this, options);

//Create the SkinOptions, and setup React
Expand All @@ -60,6 +82,9 @@ void completePlayerSetup(boolean asked) {
player.addObserver(this);

if (player.setEmbedCode(embedCode)) {
if(autoPlay) {
player.play();
}
} else {
Log.e(TAG, "Asset Failure");
}
Expand Down
66 changes: 66 additions & 0 deletions OoyalaSkinSampleApp/app/src/main/res/layout/embed_pcode_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,72 @@

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
isheftel-ooyala marked this conversation as resolved.
Show resolved Hide resolved
android:text="@string/apikey"/>

<EditText
android:id="@+id/apikey_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="BjcWYyOu1KK2DiKOkF41Z2k0X57l.0I-V4"
android:inputType="text" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
android:text="@string/secret"/>

<EditText
android:id="@+id/secret_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="1ysC3V-g8m9V3QoGJwRa_fXcfi_G2ZV778m17pux"
android:inputType="text" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
android:text="@string/accountid"/>

<EditText
android:id="@+id/accountId_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="dulari_qa"
android:inputType="text" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
3 changes: 3 additions & 0 deletions OoyalaSkinSampleApp/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<string name="open">Open</string>
<string name="pcode">pcode:</string>
<string name="embed">embed:</string>
<string name="apikey">apikey:</string>
<string name="secret">secret:</string>
<string name="accountid">account Id:</string>
<string name="select_player">Select Player:</string>
<string name="auto_play">AutoPlay</string>
<string name="take_screenshot">Take a screenshot</string>
Expand Down