diff --git a/.gitignore b/.gitignore index 02cd23deb..e0e1c871d 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,3 @@ go_script/pkg .DS_Store runConfigurations.xml *.iml -VRSampleApp/app/src/main/assets/data.json -VRSampleAppKotlin/app/src/main/assets/data.json diff --git a/AdvancedPlaybackSampleApp/app/build.gradle b/AdvancedPlaybackSampleApp/app/build.gradle index 7a665faf4..0065278ea 100644 --- a/AdvancedPlaybackSampleApp/app/build.gradle +++ b/AdvancedPlaybackSampleApp/app/build.gradle @@ -19,7 +19,7 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') into new File(projectDir, './libs') doLast { println "Jars updated." @@ -33,11 +33,11 @@ dependencies { // implementation project(':core') - implementation 'com.google.android.gms:play-services-ads:10.0.1' + implementation 'com.google.android.gms:play-services-ads:12.0.0' - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation 'com.android.support:support-v4:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0' - implementation files('libs/OoyalaSDK.jar') + implementation files('libs/OoyalaSDK.aar') } diff --git a/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlayer.java b/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlayer.java index 18492dd44..468230559 100644 --- a/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlayer.java +++ b/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlayer.java @@ -20,6 +20,7 @@ import com.ooyala.android.StateNotifier; import com.ooyala.android.player.PlayerInterface; import com.ooyala.android.player.PlayerType; +import com.ooyala.android.player.exoplayer.PlayerBitmapListener; import com.ooyala.android.plugin.LifeCycleInterface; public class SampleAdPlayer extends LinearLayout implements PlayerInterface, @@ -197,4 +198,14 @@ public void setVolume(float v) {} public PlayerType getPlayerType() { return PlayerType.FLAT_PLAYER; } + + @Override + public void createBitmapScreenshot(PlayerBitmapListener playerBitmapListener) { + // TODO + } + + @Override + public boolean isMultiAudioAvailable() { + return false; + } } diff --git a/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlugin.java b/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlugin.java index a84c10b8c..c12127d0f 100644 --- a/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlugin.java +++ b/AdvancedPlaybackSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleAdPlugin.java @@ -188,4 +188,9 @@ public Set getCuePointsInMilliSeconds() { } return new HashSet(); } + + @Override + public boolean allADSPlayed() { + return false; + } } diff --git a/BasicPlaybackSampleApp/app/build.gradle b/BasicPlaybackSampleApp/app/build.gradle index 91119730a..008bae16d 100644 --- a/BasicPlaybackSampleApp/app/build.gradle +++ b/BasicPlaybackSampleApp/app/build.gradle @@ -19,7 +19,7 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') into new File(projectDir, './libs') doLast { println "Jars updated." @@ -32,10 +32,10 @@ dependencies { // For development purposes only // compile project(':core') - implementation files('libs/OoyalaSDK.jar') - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation files('libs/OoyalaSDK.aar') + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation 'com.android.support:support-v4:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0' - implementation 'com.google.android.gms:play-services-ads:10.0.1' + implementation 'com.google.android.gms:play-services-ads:12.0.0' } diff --git a/BasicPlaybackSampleApp/build.gradle b/BasicPlaybackSampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/BasicPlaybackSampleApp/build.gradle +++ b/BasicPlaybackSampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/ChromecastSampleApp/.gitignore b/ChromecastSampleApp/.gitignore index afbdab33e..39fb081a4 100644 --- a/ChromecastSampleApp/.gitignore +++ b/ChromecastSampleApp/.gitignore @@ -1,6 +1,9 @@ +*.iml .gradle /local.properties /.idea/workspace.xml /.idea/libraries .DS_Store /build +/captures +.externalNativeBuild diff --git a/ChromecastSampleApp/README.md b/ChromecastSampleApp/README.md deleted file mode 100644 index d25e42d3f..000000000 --- a/ChromecastSampleApp/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Chromecast Sample App -This project contains a sample sender application for Android that runs a working version of the sender component of the Ooyala Chromecast Integration. - -See [http://support.ooyala.com/developers/documentation/tasks/android_cast_sample_app.html](http://support.ooyala.com/developers/documentation/tasks/android_cast_sample_app.html) for documentation that explains how to get started with this sample application. - -This application should not be used for testing or evaluating Ooyala SDK capabilities. diff --git a/ChromecastSampleApp/app/build.gradle b/ChromecastSampleApp/app/build.gradle index 1a2103035..626b44e09 100644 --- a/ChromecastSampleApp/app/build.gradle +++ b/ChromecastSampleApp/app/build.gradle @@ -26,7 +26,7 @@ repositories { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaCastSDK-Android/OoyalaCastSDK.aar') into new File(projectDir, './libs') doLast { @@ -41,15 +41,14 @@ dependencies { // compile project(':cast') // compile project(':core') - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' - + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:mediarouter-v7:26.1.0' - implementation 'com.google.android.gms:play-services-cast:10.0.1' - - implementation(name: 'OoyalaCastSDK', ext: 'aar') - implementation files('libs/OoyalaSDK.jar') - implementation project(':CastCompanionLibrary') + implementation 'com.google.android.gms:play-services-cast-framework:12.0.0' + implementation files('libs/OoyalaSDK.aar') + implementation files('libs/OoyalaCastSDK.aar') +// For Development purpose only: +// implementation project(':core') // implementation project(':cast') -} +} \ No newline at end of file diff --git a/ChromecastSampleApp/app/proguard-rules.pro b/ChromecastSampleApp/app/proguard-rules.pro deleted file mode 100644 index 0c124db20..000000000 --- a/ChromecastSampleApp/app/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/liusha.huang/Library/Android/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/ChromecastSampleApp/app/src/main/AndroidManifest.xml b/ChromecastSampleApp/app/src/main/AndroidManifest.xml index 1c013fdb3..91a3aa453 100644 --- a/ChromecastSampleApp/app/src/main/AndroidManifest.xml +++ b/ChromecastSampleApp/app/src/main/AndroidManifest.xml @@ -1,76 +1,33 @@ + - - - - + package="com.ooyala.sample"> - - - + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:name=".SampleApplication" + android:theme="@style/Theme.CastVideosTheme"> + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" + android:value="com.ooyala.sample.CastOptionsProvider" /> - + + \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/CastOptionsProvider.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/CastOptionsProvider.java new file mode 100644 index 000000000..2facb795f --- /dev/null +++ b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/CastOptionsProvider.java @@ -0,0 +1,42 @@ + +package com.ooyala.sample; + +import android.content.Context; + +import com.google.android.gms.cast.framework.CastOptions; +import com.google.android.gms.cast.framework.OptionsProvider; +import com.google.android.gms.cast.framework.SessionProvider; +import com.google.android.gms.cast.framework.media.CastMediaOptions; +import com.google.android.gms.cast.framework.media.NotificationOptions; + +import java.util.List; + + +/** + * It is used to provide google cast options by manifest. + */ +public class CastOptionsProvider implements OptionsProvider { + private final String APP_ID = "4172C76F"; + + @Override + public CastOptions getCastOptions(Context context) { + NotificationOptions notificationOptions = new NotificationOptions.Builder() + .setPlayDrawableResId(R.drawable.ic_media_play_light) + .setPauseDrawableResId(R.drawable.ic_media_pause_light) + .build(); + CastMediaOptions mediaOptions = new CastMediaOptions.Builder() + .setNotificationOptions(notificationOptions) + .setExpandedControllerActivityClassName(ChromecastPlayerActivity.class.getName()) + .build(); + + return new CastOptions.Builder() + .setReceiverApplicationId(APP_ID) + .setCastMediaOptions(mediaOptions) + .build(); + } + + @Override + public List getAdditionalSessionProviders(Context context) { + return null; + } +} \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/CastViewManager.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/CastViewManager.java similarity index 54% rename from ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/CastViewManager.java rename to ChromecastSampleApp/app/src/main/java/com/ooyala/sample/CastViewManager.java index 6d4f9dccb..5461e56ec 100644 --- a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/CastViewManager.java +++ b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/CastViewManager.java @@ -1,4 +1,4 @@ -package com.ooyala.sample.utils; +package com.ooyala.sample; import android.app.Activity; import android.content.Context; @@ -7,40 +7,35 @@ import android.widget.TextView; import com.ooyala.android.OoyalaPlayer; -import com.ooyala.android.OoyalaPlayer.State; -import com.ooyala.android.castsdk.CastManager; +import com.ooyala.cast.CastManager; +import com.ooyala.cast.UpdateImageViewRunnable; import com.ooyala.android.item.Video; -import com.ooyala.sample.R; -/** - * This is an example of a way to manage the view that is displayed in the player while casting - */ -public class CastViewManager { +class CastViewManager { private View castView; private TextView stateTextView; - public CastViewManager(Activity activity, CastManager manager) { + CastViewManager(Activity activity, CastManager manager) { castView = activity.getLayoutInflater().inflate(R.layout.cast_video_view, null); manager.setCastView(castView); - stateTextView = (TextView)castView.findViewById(R.id.castStateTextView); + stateTextView = castView.findViewById(R.id.castStateTextView); } - public void configureCastView(Video video) { - final ImageView castBackgroundImage = (ImageView) castView.findViewById(R.id.castBackgroundImage); + void configureCastView(Video video) { + final ImageView castBackgroundImage = castView.findViewById(R.id.castBackgroundImage); // Update the ImageView on a separate thread - new Thread(new UpdateImageViewRunnable(castBackgroundImage, video.getPromoImageURL(0, 0))).start(); - TextView videoTitle = (TextView) castView.findViewById(R.id.videoTitle); + TextView videoTitle = castView.findViewById(R.id.videoTitle); videoTitle.setText(video.getTitle()); - TextView videoDescription = (TextView) castView.findViewById(R.id.videoDescription); + TextView videoDescription = castView.findViewById(R.id.videoDescription); videoDescription.setText(video.getDescription()); } - public void updateCastState(Context c, State state) { - String castDeviceName = CastManager.getVideoCastManager().getDeviceName(); + void updateCastState(Context c, OoyalaPlayer.State state) { + String castDeviceName = CastManager.getCastManager().getDeviceName(); if (state == OoyalaPlayer.State.LOADING) { stateTextView.setText(c.getString(R.string.loading)); } else if (state == OoyalaPlayer.State.PLAYING || state == OoyalaPlayer.State.PAUSED) { @@ -51,3 +46,4 @@ public void updateCastState(Context c, State state) { } } } + diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/lists/ChromecastListActivity.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastListActivity.java similarity index 52% rename from ChromecastSampleApp/app/src/main/java/com/ooyala/sample/lists/ChromecastListActivity.java rename to ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastListActivity.java index 72995275a..89789446f 100644 --- a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/lists/ChromecastListActivity.java +++ b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastListActivity.java @@ -1,31 +1,23 @@ -package com.ooyala.sample.lists; +package com.ooyala.sample; import android.content.Intent; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; +import android.content.SharedPreferences; import android.os.Bundle; -import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; -import android.widget.TextView; -import com.ooyala.sample.players.ChromecastBarebonesPlayerActivity; -import com.ooyala.sample.utils.ChromecastPlayerSelectionOption; -import com.ooyala.sample.players.ChromecastPlayerActivity; -import com.ooyala.sample.R; - -import com.google.android.libraries.cast.companionlibrary.widgets.MiniController; -import com.ooyala.android.castsdk.CastManager; +import com.google.android.gms.cast.framework.CastButtonFactory; +import com.google.android.gms.cast.framework.media.widget.MiniControllerFragment; public class ChromecastListActivity extends AppCompatActivity implements AdapterView.OnItemClickListener { private static final String TAG = "ChromecastListActivity"; - private MiniController defaultMiniController; ChromecastPlayerSelectionOption[] videoList; @Override @@ -33,96 +25,56 @@ public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate()"); super.onCreate(savedInstanceState); setContentView(R.layout.start_view); - - CastManager.getCastManager().getVideoCastManager().setStopOnDisconnect(false); - - // create the array of videos + setupActionBar(); videoList = getVideoList(); + MiniControllerFragment miniControllerFragment = (MiniControllerFragment) getSupportFragmentManager().findFragmentById(R.id.cast_mini_controller); //Create the adapter for the ListView data ArrayAdapter selectionAdapter = new ArrayAdapter(this, R.layout.list_activity_list_item); - for(ChromecastPlayerSelectionOption video : videoList) { + for (ChromecastPlayerSelectionOption video : videoList) { selectionAdapter.add(video.title); } selectionAdapter.notifyDataSetChanged(); - //Populate the listView - ListView listView = (ListView) findViewById(R.id.listView); + ListView listView = findViewById(R.id.listView); listView.setAdapter(selectionAdapter); listView.setOnItemClickListener(this); - //Restyle the CCL-provided minicontroller to have dark text - defaultMiniController = (MiniController) findViewById(R.id.miniController1); - TextView title = (TextView)defaultMiniController.findViewById(R.id.title_view); - title.setTextColor(Color.BLACK); - TextView subtitle = (TextView)defaultMiniController.findViewById(R.id.subtitle_view); - subtitle.setTextColor(Color.GRAY); - - //Add the minicontroller to the list of minicontrolers managed by CCL - CastManager.getVideoCastManager().addMiniController(defaultMiniController); - -// Uncomment it if you want to activate the customized sample app in our sample app -// customizedMiniController = (OOMiniController) findViewById(R.id.miniController2); } @Override public void onItemClick(AdapterView parent, View view, int position, long id) { final Intent intent = new Intent(this, videoList[position].activity); - intent.putExtra("embedcode", videoList[position].embedCode); - intent.putExtra("embedcode2", videoList[position].embedCode2); - intent.putExtra("pcode", videoList[position].pcode); - intent.putExtra("domain", videoList[position].domain); + SharedPreferences lastChoosenParams = getSharedPreferences("LastChoosenParams", MODE_PRIVATE); + lastChoosenParams + .edit() + .putString("embedcode", videoList[position].embedCode) + .putString("secondEmbedCode", videoList[position].secondEmbedCode) + .putString("pcode", videoList[position].pcode) + .putString("domain", videoList[position].domain) + .apply(); startActivity(intent); } @Override public boolean onCreateOptionsMenu(Menu menu) { - super.onCreateOptionsMenu(menu); - getMenuInflater().inflate(R.menu.main, menu); - CastManager.getVideoCastManager().addMediaRouterButton(menu, R.id.media_route_menu_item); - return true; - } - - @Override - protected void onStart() { - Log.d(TAG, "onStart()"); - super.onStart(); - } - - @Override - protected void onDestroy() { - Log.d(TAG, "onDestroy()"); - CastManager.getVideoCastManager().removeMiniController(defaultMiniController); - super.onDestroy(); + boolean createOptionsMenu = super.onCreateOptionsMenu(menu); + getMenuInflater().inflate(R.menu.browse, menu); + CastButtonFactory.setUpMediaRouteButton(getApplicationContext(), menu, + R.id.media_route_menu_item); + return createOptionsMenu; } - @Override - public void onResume() { - super.onResume(); - if (CastManager.getCastManager().isInCastMode()) { - defaultMiniController.setVisibility(View.VISIBLE); - } -// Uncomment it if you want to activate the customized sample app in our sample app -// castManager.addMiniController(customizedMiniController); -// this.customizedMiniController.show(); - //onPause and onResume, call CCL code to support Cast Notifications - CastManager.getCastManager().onResume(); - Log.d(TAG, "onResume()"); - } - - @Override - public void onPause() { - Log.d(TAG, "onPause()"); - //onPause and onResume, call CCL code to support Cast Notifications - CastManager.getCastManager().onPause(); - super.onPause(); + private void setupActionBar() { + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); } /** - Generate the list of all videos for the list + * Generate the list of all videos for the list */ private ChromecastPlayerSelectionOption[] getVideoList() { - return new ChromecastPlayerSelectionOption[] { + return new ChromecastPlayerSelectionOption[]{ new ChromecastPlayerSelectionOption("HLS Asset", "Y1ZHB1ZDqfhCPjYYRbCEOz0GR8IsVRm1", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ChromecastPlayerActivity.class), new ChromecastPlayerSelectionOption("MP4 Video", "h4aHB1ZDqV7hbmLEv4xSOx3FdUUuephx", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ChromecastPlayerActivity.class), new ChromecastPlayerSelectionOption("VOD CC", "92cWp0ZDpDm4Q8rzHfVK6q9m6OtFP-ww", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ChromecastPlayerActivity.class), @@ -137,7 +89,7 @@ private ChromecastPlayerSelectionOption[] getVideoList() { // 3. an API Key and Secret for the provider to locally-sign the authorization (set in the PlayerViewController) new ChromecastPlayerSelectionOption("Ooyala Player Token Asset (unconfigured)", "0yMjJ2ZDosUnthiqqIM3c8Eb8Ilx5r52", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ChromecastPlayerActivity.class), new ChromecastPlayerSelectionOption("Concurrent Streams (unconfigured)", "pwc3J0dTpAL7gMLFNVt2ks2v8j3qOKCS", "FoeG863GnBL4IhhlFC1Q2jqbkH9m", "http://www.ooyala.com", ChromecastPlayerActivity.class), - new ChromecastPlayerSelectionOption("Barebones Player Activity Demo (HLS Asset)", "Y1ZHB1ZDqfhCPjYYRbCEOz0GR8IsVRm1", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ChromecastBarebonesPlayerActivity.class), + new ChromecastPlayerSelectionOption("Barebones Player Activity Demo (HLS Asset)", "Y1ZHB1ZDqfhCPjYYRbCEOz0GR8IsVRm1", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ChromecastPlayerActivity.class), }; } diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastPlayerActivity.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastPlayerActivity.java new file mode 100644 index 000000000..97708a355 --- /dev/null +++ b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastPlayerActivity.java @@ -0,0 +1,204 @@ +package com.ooyala.sample; + +import android.content.SharedPreferences; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.Menu; + +import com.google.android.gms.cast.framework.CastButtonFactory; +import com.ooyala.android.EmbedTokenGenerator; +import com.ooyala.android.EmbedTokenGeneratorCallback; +import com.ooyala.android.EmbeddedSecureURLGenerator; +import com.ooyala.android.OoyalaNotification; +import com.ooyala.android.OoyalaPlayer; +import com.ooyala.android.OoyalaPlayerLayout; +import com.ooyala.android.PlayerDomain; +import com.ooyala.android.configuration.Options; +import com.ooyala.android.ui.OoyalaPlayerLayoutController; +import com.ooyala.android.util.SDCardLogcatOoyalaEventsLogger; +import com.ooyala.cast.CastManager; + +import java.net.URL; +import java.util.HashMap; +import java.util.List; +import java.util.Observable; +import java.util.Observer; + +public class ChromecastPlayerActivity extends AppCompatActivity implements Observer, EmbedTokenGenerator { + private static final String TAG = ChromecastPlayerActivity.class.getSimpleName(); + + /* + * 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 = "fill me in"; + private final String SECRET = "fill me in"; + private final String ACCOUNT_ID = "accountID"; + + CastManager castManager; + CastViewManager castViewManager; + + private String embedCode; + private String secondEmbedCode; + private String pcode; + private String domain; + + // Write the sdk events text along with events count to log file in sdcard if the log file already exists + SDCardLogcatOoyalaEventsLogger Playbacklog = new SDCardLogcatOoyalaEventsLogger(); + + private OoyalaPlayer player; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.player_activity); + setupActionBar(); + parseSharedPreferences(); + castManager = CastManager.getCastManager(); + initOoyala(); + castViewManager = new CastViewManager(this, castManager); + } + + @Override + protected void onStart() { + super.onStart(); + if (castManager != null && player != null) { + castManager.registerWithOoyalaPlayer(player); + } + } + + 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); + pcode = lastChoosenParams.getString("pcode", ""); + domain = lastChoosenParams.getString("domain", ""); + } + } + + private void initOoyala() { + PlayerDomain playerDomain = new PlayerDomain(domain); + Options options = new Options.Builder().setUseExoPlayer(true).build(); + OoyalaPlayerLayout ooyalaPlayerLayout = findViewById(R.id.ooyalaPlayer); + player = new OoyalaPlayer(pcode, playerDomain, this, options); + new OoyalaPlayerLayoutController(ooyalaPlayerLayout, player); + castManager.registerWithOoyalaPlayer(player); + player.addObserver(this); + play(embedCode); + } + + private void play(String ec) { + player.setEmbedCode(ec); + // Uncomment for Auto-Play + player.play(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + boolean createOptionsMenu = super.onCreateOptionsMenu(menu); + getMenuInflater().inflate(R.menu.browse, menu); + CastButtonFactory.setUpMediaRouteButton(getApplicationContext(), menu, + R.id.media_route_menu_item); + return createOptionsMenu; + } + + private void setupActionBar() { + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + } + + /** + * Listen to all notifications from the OoyalaPlayer + */ + @Override + public void update(Observable arg0, Object argN) { + if (arg0 != player) { + return; + } + + final String arg1 = OoyalaNotification.getNameOrUnknown(argN); + if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) { + return; + } + + if (arg1 == OoyalaPlayer.CURRENT_ITEM_CHANGED_NOTIFICATION_NAME) { + castViewManager.configureCastView(player.getCurrentItem()); + } else if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) { + final String msg = "Error Event Received"; + if (player != null && player.getError() != null) { + Log.e(TAG, msg, player.getError()); + } else { + Log.e(TAG, msg); + } + } + + if (arg1 == OoyalaPlayer.STATE_CHANGED_NOTIFICATION_NAME) { + if (player.isInCastMode()) { + OoyalaPlayer.State state = player.getState(); + castViewManager.updateCastState(this, state); + } + } + + if (arg1 == OoyalaPlayer.PLAY_COMPLETED_NOTIFICATION_NAME && secondEmbedCode != null) { + play(secondEmbedCode); + secondEmbedCode = null; + } + + // Automation Hook: to write Notifications to a temporary file on the device/emulator + String text = "Notification Received: " + arg1 + " - state: " + player.getState(); + // Automation Hook: Write the event text along with event count to log file in sdcard if the log file exists + Playbacklog.writeToSdcardLog(text); + + Log.d(TAG, "Notification Received: " + arg1 + " - state: " + player.getState()); + } + + @Override + public void getTokenForEmbedCodes(List embedCodes, EmbedTokenGeneratorCallback callback) { + String embedCodesString = ""; + for (String ec : embedCodes) { + if (ec.equals("")) embedCodesString += ","; + embedCodesString += ec; + } + + HashMap params = new HashMap<>(); + params.put("account_id", ACCOUNT_ID); + + String uri = "/sas/embed_token/" + pcode + "/" + embedCodesString; + + EmbeddedSecureURLGenerator urlGen = new EmbeddedSecureURLGenerator(APIKEY, SECRET); + + URL tokenUrl = urlGen.secureURL("http://player.ooyala.com", uri, params); + + callback.setEmbedToken(tokenUrl.toString()); + } + + @Override + protected void onStop() { + super.onStop(); + if (castManager != null) { + castManager.deregisterFromOoyalaPlayer(); + } + } + + + @Override + public void onResume() { + super.onResume(); + if (player != null) { + player.resume(); + } + } + + @Override + public void onPause() { + super.onPause(); + if (player != null) { + player.suspend(); + } + } +} + diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/ChromecastPlayerSelectionOption.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastPlayerSelectionOption.java similarity index 54% rename from ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/ChromecastPlayerSelectionOption.java rename to ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastPlayerSelectionOption.java index e352427c3..e47a37fdd 100644 --- a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/ChromecastPlayerSelectionOption.java +++ b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/ChromecastPlayerSelectionOption.java @@ -1,24 +1,24 @@ -package com.ooyala.sample.utils; +package com.ooyala.sample; import android.app.Activity; public class ChromecastPlayerSelectionOption { public String title; public String embedCode; - public String embedCode2; + public String secondEmbedCode; public String pcode; public String domain; - public Class activity; + public Class activity; - public ChromecastPlayerSelectionOption(String title, String embedCode, String pcode, String domain, Class activity) { - this( title, embedCode, null, pcode, domain, activity); + public ChromecastPlayerSelectionOption(String title, String embedCode, String pcode, String domain, Class activity) { + this(title, embedCode, null, pcode, domain, activity); } - public ChromecastPlayerSelectionOption(String title, String embedCode, String embedCode2, String pcode, String domain, Class activity) { + public ChromecastPlayerSelectionOption(String title, String embedCode, String secondEmbedCode, String pcode, String domain, Class activity) { super(); this.title = title; this.embedCode = embedCode; - this.embedCode2 = embedCode2; + this.secondEmbedCode = secondEmbedCode; this.pcode = pcode; this.domain = domain; this.activity = activity; diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/SampleApplication.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/SampleApplication.java new file mode 100644 index 000000000..06c85716e --- /dev/null +++ b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/SampleApplication.java @@ -0,0 +1,22 @@ +package com.ooyala.sample; + +import android.app.Application; + +import com.ooyala.cast.CastManager; + +public class SampleApplication extends Application { + CastManager castManager; + private final String NAMESPACE = "urn:x-cast:ooyala"; + + @Override + public void onCreate() { + super.onCreate(); + try { + CastManager.initialize(this, NAMESPACE); + castManager = CastManager.getCastManager(); + } catch (CastManager.CastManagerInitializationException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } +} diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/players/ChromecastBarebonesPlayerActivity.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/players/ChromecastBarebonesPlayerActivity.java deleted file mode 100644 index 91f187ce1..000000000 --- a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/players/ChromecastBarebonesPlayerActivity.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.ooyala.sample.players; - -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.util.Log; -import android.view.Menu; - -import com.ooyala.android.OoyalaPlayer; -import com.ooyala.android.OoyalaNotification; -import com.ooyala.android.OoyalaPlayerLayout; -import com.ooyala.android.PlayerDomain; -import com.ooyala.android.castsdk.CastManager; -import com.ooyala.android.configuration.Options; -import com.ooyala.android.ui.OoyalaPlayerLayoutController; -import com.ooyala.sample.R; -import com.ooyala.android.util.SDCardLogcatOoyalaEventsLogger; - -import java.util.Observable; -import java.util.Observer; - -/** - * This activity is meant to show the absolute bare minimum code you need to see video playback - * on the Chromecast. This will not have some key functionality for user experience, but will show - * the simplest code for Chromecast integration with the player. - * - * Please check the ChromecastPlayerActivity to see a more complete integration, containing all supported - * functionality - */ -public class ChromecastBarebonesPlayerActivity extends AppCompatActivity implements Observer{ - - private static final String TAG = ChromecastBarebonesPlayerActivity.class.getSimpleName(); - private String embedCode; - private String pcode; - private String domain; - private OoyalaPlayer player; - - // Write the sdk events text along with events count to log file in sdcard if the log file already exists - SDCardLogcatOoyalaEventsLogger Playbacklog= new SDCardLogcatOoyalaEventsLogger(); - - @Override - public void onCreate(Bundle savedInstanceState) { - Log.d(TAG, "onCreate()"); - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - // Get the information from the extras - Bundle extras = getIntent().getExtras(); - embedCode = extras.getString("embedcode"); - pcode = extras.getString("pcode"); - domain = extras.getString("domain"); - - // Initialize Ooyala Player - OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer); - PlayerDomain playerDomain = new PlayerDomain(domain); - - Options options = new Options.Builder().setUseExoPlayer(true).build(); - player = new OoyalaPlayer(pcode, playerDomain, options); - OoyalaPlayerLayoutController playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player); - - //Create a CastManager, and connect to the OoyalaPlayer - CastManager castManager = CastManager.getCastManager(); - castManager.registerWithOoyalaPlayer(player); - - //Observe, set the embed code, and play - player.addObserver(this); - player.setEmbedCode(embedCode); - //Uncomment for Auto-Play - //player.play(); - } - - @Override - public void onPause() { - Log.d(TAG, "onPause()"); - if (player != null) { - player.suspend(); - } - - //onPause and onResume, call CCL code to support Cast Notifications - CastManager.getCastManager().onPause(); - super.onPause(); - } - - @Override - protected void onStart() { - Log.d(TAG, "onStart()"); - super.onStart(); - } - - @Override - protected void onDestroy() { - Log.d(TAG, "onDestroy()"); - - //When we destroy, clean up the Singleton CastManager by removing our OoyalaPlayer. - CastManager.getCastManager().deregisterFromOoyalaPlayer(); - player = null; - super.onDestroy(); - } - - @Override - protected void onResume() { - if (player != null) { - player.resume(); - } - - //onPause and onResume, call CCL code to support Cast Notifications - CastManager.getCastManager().onResume(); - super.onResume(); - } - - /** - * Populate the ActionBar Menu with the Cast button - */ - @Override - public boolean onCreateOptionsMenu(Menu menu) { - Log.d(TAG, "onCreateOptionsMenu()"); - super.onCreateOptionsMenu(menu); - getMenuInflater().inflate(R.menu.main, menu); - CastManager.getVideoCastManager().addMediaRouterButton(menu, R.id.media_route_menu_item); - return true; - } - - /** - * Listen to all notifications from the OoyalaPlayer - */ - @Override - public void update(Observable arg0, Object argN) { - if (arg0 != player) { - return; - } - - final String arg1 = OoyalaNotification.getNameOrUnknown(argN); - if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) { - return; - } - - if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) { - final String msg = "Error Event Received"; - if (player != null && player.getError() != null) { - Log.e(TAG, msg, player.getError()); - } - else { - Log.e(TAG, msg); - } - } - - // Automation Hook: to write Notifications to a temporary file on the device/emulator - String text="Notification Received: " + arg1 + " - state: " + player.getState(); - // Automation Hook: Write the event text along with event count to log file in sdcard if the log file exists - Playbacklog.writeToSdcardLog(text); - - Log.d(TAG, "Notification Received: " + arg1 + " - state: " + player.getState()); - } - - -} diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/players/ChromecastPlayerActivity.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/players/ChromecastPlayerActivity.java deleted file mode 100644 index e949f3793..000000000 --- a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/players/ChromecastPlayerActivity.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.ooyala.sample.players; - -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.util.Log; -import android.view.KeyEvent; -import android.view.Menu; - -import com.google.android.gms.cast.MediaInfo; -import com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager; -import com.google.android.libraries.cast.companionlibrary.utils.Utils; -import com.ooyala.android.EmbedTokenGenerator; -import com.ooyala.android.EmbedTokenGeneratorCallback; -import com.ooyala.android.EmbeddedSecureURLGenerator; -import com.ooyala.android.OoyalaPlayer; -import com.ooyala.android.OoyalaNotification; -import com.ooyala.android.OoyalaPlayerLayout; -import com.ooyala.android.PlayerDomain; -import com.ooyala.android.castsdk.CastManager; -import com.ooyala.android.configuration.Options; -import com.ooyala.android.ui.OoyalaPlayerLayoutController; -import com.ooyala.sample.R; -import com.ooyala.android.util.SDCardLogcatOoyalaEventsLogger; - -import com.ooyala.sample.utils.CastViewManager; - -import org.json.JSONObject; - -import java.net.URL; -import java.util.HashMap; -import java.util.List; -import java.util.Observable; -import java.util.Observer; - -/** - * This activity demonstrates all functionality supported by the Ooyala Cast Integration. - * - * This includes, but is not limited to: - * Multi video playback - * OPT and OPT-related content protection - * CastViews - views that display in the player during Cast playback - * Updating of Cast View based on the state of the player - * Responding to hardware volume buttons - * Notifications support - */ -public class ChromecastPlayerActivity extends AppCompatActivity implements EmbedTokenGenerator, Observer{ - - private static final String TAG = ChromecastPlayerActivity.class.getSimpleName(); - private static final double DEFAULT_VOLUME_INCREMENT = 0.05; - private String embedCode; - private String embedCode2; - private String pcode; - private String domain; - private OoyalaPlayer player; - private CastViewManager castViewManager; - private final String ACCOUNT_ID = "accountID"; - - // Write the sdk events text along with events count to log file in sdcard if the log file already exists - SDCardLogcatOoyalaEventsLogger Playbacklog= new SDCardLogcatOoyalaEventsLogger(); - - /* - * 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 = "fill me in"; - private final String SECRET = "fill me in"; - - /** - * Called when the activity is first created. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - Log.d(TAG, "onCreate()"); - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - // onClick of a DefaultMiniController only provides an embedcode through the extras - Bundle extras = getIntent().getExtras(); - if (extras.containsKey(VideoCastManager.EXTRA_MEDIA)) { - Bundle mediaInfoBundle = extras.getBundle(VideoCastManager.EXTRA_MEDIA); - MediaInfo mediaInfo = Utils.bundleToMediaInfo(mediaInfoBundle); - embedCode = mediaInfo.getContentId(); - JSONObject json = mediaInfo.getCustomData(); - try { - pcode = json.getString("pcode"); - domain = json.getString("domain"); - } catch(Exception e) { - pcode = "FoeG863GnBL4IhhlFC1Q2jqbkH9m"; - domain = "http://www.ooyala.com"; - } - } else { - embedCode = extras.getString("embedcode"); - embedCode2 = extras.getString("embedcode2"); - pcode = extras.getString("pcode"); - domain = extras.getString("domain"); - } - - // Initialize Ooyala Player - OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer); - - PlayerDomain playerDomain = new PlayerDomain(domain); - Options options = new Options.Builder().setUseExoPlayer(true).build(); - player = new OoyalaPlayer(pcode, playerDomain, this, options); - OoyalaPlayerLayoutController playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player); - - //Create a CastManager, and connect to the OoyalaPlayer - CastManager castManager = CastManager.getCastManager(); - castManager.registerWithOoyalaPlayer(player); - castViewManager = new CastViewManager(this, castManager); - - //Observe, set the embed code, and play - player.addObserver(this); - play( embedCode ); - } - - private void play( String ec ) { - player.setEmbedCode(ec); - // Uncomment for Auto-Play - //player.play(); - } - - @Override - public void onPause() { - Log.d(TAG, "onPause()"); - if (player != null) { - player.suspend(); - } - //onPause and onResume, call CCL code to support Cast Notifications - CastManager.getCastManager().onPause(); - super.onPause(); - } - - @Override - protected void onStart() { - Log.d(TAG, "onStart()"); - super.onStart(); - } - - @Override - protected void onDestroy() { - Log.d(TAG, "onDestroy()"); - CastManager.getCastManager().deregisterFromOoyalaPlayer(); - player = null; - super.onDestroy(); - } - - @Override - protected void onResume() { - super.onResume(); - if (player != null) { - player.resume(); - } - //onPause and onResume, call CCL code to support Cast Notifications - CastManager.getCastManager().onResume(); - } - - /** - * Populate the ActionBar Menu with the Cast button - */ - @Override - public boolean onCreateOptionsMenu(Menu menu) { - Log.d(TAG, "onCreateOptionsMenu()"); - super.onCreateOptionsMenu(menu); - getMenuInflater().inflate(R.menu.main, menu); - CastManager.getVideoCastManager().addMediaRouterButton(menu, R.id.media_route_menu_item); - return true; - } - - - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { - if (CastManager.getVideoCastManager() != null) { - if (CastManager.getVideoCastManager().onDispatchVolumeKeyEvent(event, DEFAULT_VOLUME_INCREMENT)) { - return true; - } - } - return super.onKeyDown(keyCode, event); - } - - private void onVolumeChange(double volumeIncrement) { - try { - Log.d(TAG, "Increase DeviceVolume: " + volumeIncrement); - CastManager.getVideoCastManager().adjustDeviceVolume(volumeIncrement); - } catch (Exception e) { - Log.e(TAG, "onVolumeChange() Failed to change volume", e); - } - } - - /** - * Listen to all notifications from the OoyalaPlayer - */ - @Override - public void update(Observable arg0, Object argN) { - if (arg0 != player) { - return; - } - - final String arg1 = OoyalaNotification.getNameOrUnknown(argN); - if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) { - return; - } - - if (arg1 == OoyalaPlayer.CURRENT_ITEM_CHANGED_NOTIFICATION_NAME) { - castViewManager.configureCastView(player.getCurrentItem()); - } else if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) { - final String msg = "Error Event Received"; - if (player != null && player.getError() != null) { - Log.e(TAG, msg, player.getError()); - } - else { - Log.e(TAG, msg); - } - } - - if (arg1 == OoyalaPlayer.STATE_CHANGED_NOTIFICATION_NAME) { - if (player.isInCastMode()) { - OoyalaPlayer.State state = player.getState(); - castViewManager.updateCastState(this, state); - } - } - - if( arg1 == OoyalaPlayer.PLAY_COMPLETED_NOTIFICATION_NAME && embedCode2 != null ) { - play( embedCode2 ); - embedCode2 = null; - } - - // Automation Hook: to write Notifications to a temporary file on the device/emulator - String text="Notification Received: " + arg1 + " - state: " + player.getState(); - // Automation Hook: Write the event text along with event count to log file in sdcard if the log file exists - Playbacklog.writeToSdcardLog(text); - - Log.d(TAG, "Notification Received: " + arg1 + " - state: " + player.getState()); - } - - /* - * Get the Ooyala Player Token to play the embed code. - * This should contact your servers to generate the OPT server-side. - * For debugging, you can use Ooyala's EmbeddedSecureURLGenerator to create local embed tokens - */ - @Override - public void getTokenForEmbedCodes(List embedCodes, - EmbedTokenGeneratorCallback callback) { - String embedCodesString = ""; - for (String ec : embedCodes) { - if(ec.equals("")) embedCodesString += ","; - embedCodesString += ec; - } - - HashMap params = new HashMap(); - params.put("account_id", ACCOUNT_ID); - - String uri = "/sas/embed_token/" + pcode + "/" + embedCodesString; - - EmbeddedSecureURLGenerator urlGen = new EmbeddedSecureURLGenerator(APIKEY, SECRET); - - URL tokenUrl = urlGen.secureURL("http://player.ooyala.com", uri, params); - - callback.setEmbedToken(tokenUrl.toString()); - } - -} diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleApplication.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleApplication.java deleted file mode 100644 index 0f5c4a2f8..000000000 --- a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/SampleApplication.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ooyala.sample.utils; - -import android.app.Application; -import android.content.pm.ApplicationInfo; - -import com.ooyala.android.castsdk.CastManager; -import com.ooyala.android.castsdk.CastOptions; - -import com.ooyala.sample.players.ChromecastPlayerActivity; - -/** - * This application is made to initialize the CastManager right at the start of the app load - * - * This step does not necessarily have to happen in the Application class, but is a reccomended option - */ -public class SampleApplication extends Application { - private final String NAMESPACE = "urn:x-cast:ooyala"; - private final String APP_ID = "4172C76F"; - - @Override - public void onCreate() { - super.onCreate(); - try { - boolean isDebuggable = ( 0 != ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) ); - CastOptions options = new CastOptions.Builder(APP_ID, NAMESPACE).setEnableCastDebug(isDebuggable).setTargetActivity(ChromecastPlayerActivity.class).build(); - CastManager.initialize(this, options); - } catch (CastManager.CastManagerInitializationException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } -} diff --git a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/UpdateImageViewRunnable.java b/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/UpdateImageViewRunnable.java deleted file mode 100644 index b8ebdbbf9..000000000 --- a/ChromecastSampleApp/app/src/main/java/com/ooyala/sample/utils/UpdateImageViewRunnable.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ooyala.sample.utils; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.os.Handler; -import android.os.Looper; -import android.util.Log; -import android.widget.ImageView; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; - -/** - * Update the ImageView's image based on a url - */ -public class UpdateImageViewRunnable implements Runnable { - private static String TAG = UpdateImageViewRunnable.class.getSimpleName(); - - ImageView view; - String url; - - public UpdateImageViewRunnable(ImageView view, String url) { - this.view = view; - this.url = url; - } - @Override - public void run() { - final Bitmap bitmap = getImageBitmap(url); - - Handler handler = new Handler(Looper.getMainLooper()); - handler.post(new Runnable() { - public void run() { - if (bitmap != null) { - view.setImageBitmap(bitmap); - } - } - }); - } - - private Bitmap getImageBitmap(String strUrl) { - Bitmap bm = null; - try { - URL url = new URL(strUrl); - URLConnection conn = url.openConnection(); - conn.connect(); - InputStream is = conn.getInputStream(); - BufferedInputStream bis = new BufferedInputStream(is); - bm = BitmapFactory.decodeStream(bis); - bis.close(); - is.close(); - } catch (IOException e) { - Log.e(TAG, "Error getting bitmap", e); - } - return bm; - } -} diff --git a/ChromecastSampleApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 8074c4c57..000000000 Binary files a/ChromecastSampleApp/app/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/ChromecastSampleApp/app/src/main/res/drawable-ldpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/drawable-ldpi/ic_launcher.png deleted file mode 100644 index 1095584ec..000000000 Binary files a/ChromecastSampleApp/app/src/main/res/drawable-ldpi/ic_launcher.png and /dev/null differ diff --git a/ChromecastSampleApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index a07c69fa5..000000000 Binary files a/ChromecastSampleApp/app/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/ChromecastSampleApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/ChromecastSampleApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 000000000..c7bd21dbd --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/ChromecastSampleApp/app/src/main/res/drawable/ic_launcher_background.xml b/ChromecastSampleApp/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 000000000..d5fccc538 --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ChromecastSampleApp/app/src/main/res/drawable/ic_ooyala.png b/ChromecastSampleApp/app/src/main/res/drawable/ic_ooyala.png deleted file mode 100644 index b5e36f173..000000000 Binary files a/ChromecastSampleApp/app/src/main/res/drawable/ic_ooyala.png and /dev/null differ diff --git a/ChromecastSampleApp/app/src/main/res/drawable/shadow7.9.png b/ChromecastSampleApp/app/src/main/res/drawable/shadow7.9.png deleted file mode 100644 index 6d00d0967..000000000 Binary files a/ChromecastSampleApp/app/src/main/res/drawable/shadow7.9.png and /dev/null differ diff --git a/ChromecastSampleApp/app/src/main/res/layout/cast_video_view.xml b/ChromecastSampleApp/app/src/main/res/layout/cast_video_view.xml index 7d6b778e8..054a5a499 100644 --- a/ChromecastSampleApp/app/src/main/res/layout/cast_video_view.xml +++ b/ChromecastSampleApp/app/src/main/res/layout/cast_video_view.xml @@ -2,7 +2,7 @@ - + - + android:scaleType="fitCenter"/> + - + - - - - - - - - - - - - - \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/res/layout/customized_ooyala_mini_controller.xml b/ChromecastSampleApp/app/src/main/res/layout/customized_ooyala_mini_controller.xml deleted file mode 100644 index 455092527..000000000 --- a/ChromecastSampleApp/app/src/main/res/layout/customized_ooyala_mini_controller.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/res/layout/list_activity_layout.xml b/ChromecastSampleApp/app/src/main/res/layout/list_activity_layout.xml index fd6d9b46e..513ebda98 100644 --- a/ChromecastSampleApp/app/src/main/res/layout/list_activity_layout.xml +++ b/ChromecastSampleApp/app/src/main/res/layout/list_activity_layout.xml @@ -7,20 +7,14 @@ android:paddingRight="16dp" android:paddingTop="16dp" android:orientation="vertical" - tools:context=".MainActivity" > - - + android:background="#313131" + tools:context=".ChromecastPlayerActivity" > + diff --git a/ChromecastSampleApp/app/src/main/res/layout/main.xml b/ChromecastSampleApp/app/src/main/res/layout/main.xml deleted file mode 100644 index a8fc7000c..000000000 --- a/ChromecastSampleApp/app/src/main/res/layout/main.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/res/layout/player_activity.xml b/ChromecastSampleApp/app/src/main/res/layout/player_activity.xml new file mode 100644 index 000000000..95c2b92d8 --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/layout/player_activity.xml @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/ChromecastSampleApp/app/src/main/res/layout/start_view.xml b/ChromecastSampleApp/app/src/main/res/layout/start_view.xml index 8a98eef05..01cd3a4cd 100644 --- a/ChromecastSampleApp/app/src/main/res/layout/start_view.xml +++ b/ChromecastSampleApp/app/src/main/res/layout/start_view.xml @@ -1,19 +1,33 @@ + android:background="#313131" + android:orientation="vertical"> - - + android:background="?attr/colorPrimary" + android:minHeight="?attr/actionBarSize" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> + + + - - diff --git a/ChromecastSampleApp/app/src/main/res/menu/browse.xml b/ChromecastSampleApp/app/src/main/res/menu/browse.xml new file mode 100644 index 000000000..0a3f3b397 --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/menu/browse.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/res/menu/main.xml b/ChromecastSampleApp/app/src/main/res/menu/main.xml deleted file mode 100644 index c6f39d823..000000000 --- a/ChromecastSampleApp/app/src/main/res/menu/main.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/ChromecastSampleApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000..eca70cfe5 --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/ChromecastSampleApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 000000000..eca70cfe5 --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-hdpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..a2f590828 Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/ChromecastSampleApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 000000000..1b5239980 Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-mdpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..ff10afd6e Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/ChromecastSampleApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 000000000..115a4c768 Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..dcd3cd808 Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/ChromecastSampleApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 000000000..459ca609d Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..8ca12fe02 Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/ChromecastSampleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..8e19b410a Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/ChromecastSampleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..b824ebdd4 Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/ChromecastSampleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/ChromecastSampleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..4c19a13c2 Binary files /dev/null and b/ChromecastSampleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/ChromecastSampleApp/app/src/main/res/values/colors.xml b/ChromecastSampleApp/app/src/main/res/values/colors.xml new file mode 100644 index 000000000..d07a0b6e0 --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/values/colors.xml @@ -0,0 +1,33 @@ + + + #3F51B5 + #303F9F + #FF4081 + + #30000000 + #30FF0000 + #00000000 + #AA000000 + #000000 + #FFFFFF + #AAFADCA7 + #FADCA7 + #2c393d + #EEFF41 + #EEFF41 + #506a7d + + #03A9F4 + #0288D1 + #B3E5FC + @color/primary + #212121 + #727272 + #FFFFFF + #B6B6B6 + @color/primary + + #CC33B5E5 + #1E9618 + + diff --git a/ChromecastSampleApp/app/src/main/res/values/strings.xml b/ChromecastSampleApp/app/src/main/res/values/strings.xml index 92df22ff3..b131335c3 100644 --- a/ChromecastSampleApp/app/src/main/res/values/strings.xml +++ b/ChromecastSampleApp/app/src/main/res/values/strings.xml @@ -1,7 +1,13 @@ - Hello World, ChromecastSampleAppActivity! - Ooyala Chromecast Sample App - Play on.. - Loading - Casting to %s + ChromecastSampleApp + 4F8B3483 + + 4172C76F + Loading + Casting to %s + + @id/cast_button_type_rewind_30_seconds + @id/cast_button_type_play_pause_toggle + @id/cast_button_type_forward_30_seconds + diff --git a/ChromecastSampleApp/app/src/main/res/values/styles.xml b/ChromecastSampleApp/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..a05e5d34b --- /dev/null +++ b/ChromecastSampleApp/app/src/main/res/values/styles.xml @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/ChromecastSampleApp/build.gradle b/ChromecastSampleApp/build.gradle index 9c2a3f219..ac5736d9d 100644 --- a/ChromecastSampleApp/build.gradle +++ b/ChromecastSampleApp/build.gradle @@ -1,12 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + repositories { - jcenter() google() + jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -15,11 +17,15 @@ buildscript { allprojects { repositories { - jcenter() google() + jcenter() } } +task clean(type: Delete) { + delete rootProject.buildDir +} + ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/ChromecastSampleApp/gradle.properties b/ChromecastSampleApp/gradle.properties index 1d3591c8a..aac7c9b46 100644 --- a/ChromecastSampleApp/gradle.properties +++ b/ChromecastSampleApp/gradle.properties @@ -9,10 +9,9 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true diff --git a/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.jar b/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.jar index 8c0fb64a8..13372aef5 100644 Binary files a/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.jar and b/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.jar differ diff --git a/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.properties b/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.properties index 7ae7662e7..c44db28c5 100644 --- a/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.properties +++ b/ChromecastSampleApp/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Mon Apr 10 18:25:25 PDT 2017 +#Wed Jan 24 16:46:45 MSK 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/ChromecastSampleApp/gradlew b/ChromecastSampleApp/gradlew index 91a7e269e..9d82f7891 100755 --- a/ChromecastSampleApp/gradlew +++ b/ChromecastSampleApp/gradlew @@ -42,11 +42,6 @@ case "`uname`" in ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" @@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do fi done SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- +cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" -cd "$SAVED" >&- +cd "$SAVED" >/dev/null CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -114,6 +109,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` diff --git a/ChromecastSampleApp/settings.gradle b/ChromecastSampleApp/settings.gradle index c0a213325..e7b4def49 100644 --- a/ChromecastSampleApp/settings.gradle +++ b/ChromecastSampleApp/settings.gradle @@ -1,10 +1 @@ include ':app' - -include ':CastCompanionLibrary' -project(':CastCompanionLibrary').projectDir = new File(settingsDir, '../vendor/GoogleCast/CastCompanionLibrary') - -//include ':core' -//project(':core').projectDir = new File(settingsDir, '../../android-sdk/sdk/core') -// -//include ':cast' -//project(':cast').projectDir=new File(settingsDir, '../../android-sdk/sdk/cast') diff --git a/CompleteSampleApp/app/build.gradle b/CompleteSampleApp/app/build.gradle index b0f277e23..c34c4421d 100644 --- a/CompleteSampleApp/app/build.gradle +++ b/CompleteSampleApp/app/build.gradle @@ -19,10 +19,10 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaIMASDK-Android/OoyalaIMASDK.jar') from new File(vendorDir, 'Ooyala/OoyalaFreewheelSDK-Android/OoyalaFreewheelSDK.jar') - from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.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, 'NPAW/YouboraLib-5.3.1.jar') @@ -44,16 +44,16 @@ repositories { } dependencies { - implementation 'com.google.android.gms:play-services-ads:10.0.1' - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation 'com.google.android.gms:play-services-ads:12.0.0' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation 'com.android.support:support-v4:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:recyclerview-v7:26.1.0' implementation files('libs/FWAdManager.jar') implementation files('libs/OoyalaFreewheelSDK.jar') implementation files('libs/OoyalaIMASDK.jar') - implementation files('libs/OoyalaSDK.jar') - implementation files('libs/OoyalaSkinSDK.jar') + implementation files('libs/OoyalaSDK.aar') + implementation files('libs/OoyalaSkinSDK.aar') implementation files('libs/ima-android-v374.jar') implementation files('libs/android_accessenabler-1.7.3.jar') implementation files('libs/YouboraLib-5.3.1.jar') diff --git a/CompleteSampleApp/build.gradle b/CompleteSampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/CompleteSampleApp/build.gradle +++ b/CompleteSampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/ContentProtectionSampleApp/app/build.gradle b/ContentProtectionSampleApp/app/build.gradle index d56948c85..8191646c2 100644 --- a/ContentProtectionSampleApp/app/build.gradle +++ b/ContentProtectionSampleApp/app/build.gradle @@ -19,7 +19,7 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'AdobePass/android_accessenabler-1.7.3.jar') into new File(projectDir, './libs') doLast { @@ -32,15 +32,15 @@ tasks.copyTask.execute() dependencies { implementation 'com.google.code.gson:gson:2.2.2' - implementation 'com.google.android.gms:play-services-ads:10.0.1' + 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:r2.5.3' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation files('libs/android_accessenabler-1.7.3.jar') - implementation files('libs/OoyalaSDK.jar') + implementation files('libs/OoyalaSDK.aar') } repositories { google() -} \ No newline at end of file +} diff --git a/ContentProtectionSampleApp/build.gradle b/ContentProtectionSampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/ContentProtectionSampleApp/build.gradle +++ b/ContentProtectionSampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/ExoPlayerSampleApp/app/build.gradle b/ExoPlayerSampleApp/app/build.gradle index 08c5d9ede..1c6563830 100644 --- a/ExoPlayerSampleApp/app/build.gradle +++ b/ExoPlayerSampleApp/app/build.gradle @@ -61,10 +61,10 @@ task copyFontsAssetsTask(type: Copy) { tasks.copyFontsAssetsTask.execute() task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaIMASDK-Android/OoyalaIMASDK.jar') from new File(vendorDir, 'Ooyala/OoyalaFreewheelSDK-Android/OoyalaFreewheelSDK.jar') - from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.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, 'Ooyala/OoyalaSkinSDK-Android/react-native-0.35.0.aar') @@ -92,14 +92,14 @@ dependencies { implementation files('libs/OoyalaFreewheelSDK.jar') implementation files('libs/OoyalaIMASDK.jar') implementation files('libs/ima-android-v374.jar') - implementation files('libs/OoyalaSDK.jar') - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation files('libs/OoyalaSDK.aar') + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' // For development purposes only // implementation project(':core') - implementation files('libs/OoyalaSkinSDK.jar') - implementation 'com.google.android.gms:play-services-ads:10.0.1' + implementation files('libs/OoyalaSkinSDK.aar') + implementation 'com.google.android.gms:play-services-ads:12.0.0' implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'com.facebook.fresco:fresco:0.11.0' diff --git a/ExoPlayerSampleApp/build.gradle b/ExoPlayerSampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/ExoPlayerSampleApp/build.gradle +++ b/ExoPlayerSampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/FreewheelSampleApp/app/build.gradle b/FreewheelSampleApp/app/build.gradle index fc34b04e7..c56e42968 100644 --- a/FreewheelSampleApp/app/build.gradle +++ b/FreewheelSampleApp/app/build.gradle @@ -19,7 +19,7 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaFreewheelSDK-Android/OoyalaFreewheelSDK.jar') from new File(vendorDir, 'Freewheel/Android_AdManagerDistribution/FWAdManager.jar') into new File(projectDir, './libs') @@ -31,12 +31,12 @@ task copyTask(type: Copy) { tasks.copyTask.execute() dependencies { - implementation 'com.google.android.gms:play-services-ads:10.0.1' - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation 'com.google.android.gms:play-services-ads:12.0.0' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation 'com.android.support:support-v4:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0' implementation files('libs/FWAdManager.jar') implementation files('libs/OoyalaFreewheelSDK.jar') - implementation files('libs/OoyalaSDK.jar') + implementation files('libs/OoyalaSDK.aar') } diff --git a/FreewheelSampleApp/build.gradle b/FreewheelSampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/FreewheelSampleApp/build.gradle +++ b/FreewheelSampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/ChromecastSampleApp/app/.gitignore b/HeartbeatSampleApp/.gitignore similarity index 100% rename from ChromecastSampleApp/app/.gitignore rename to HeartbeatSampleApp/.gitignore diff --git a/HeartbeatSampleApp/build.gradle b/HeartbeatSampleApp/build.gradle new file mode 100644 index 000000000..5d71b9c96 --- /dev/null +++ b/HeartbeatSampleApp/build.gradle @@ -0,0 +1,30 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "com.ooyala.ooyalaheartbeatsampleapp" + minSdkVersion 16 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support.constraint:constraint-layout:1.0.2' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + compile 'com.android.volley:volley:1.1.0' + +} diff --git a/HeartbeatSampleApp/proguard-rules.pro b/HeartbeatSampleApp/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/HeartbeatSampleApp/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/HeartbeatSampleApp/src/main/AndroidManifest.xml b/HeartbeatSampleApp/src/main/AndroidManifest.xml new file mode 100644 index 000000000..473d6cbd8 --- /dev/null +++ b/HeartbeatSampleApp/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HeartbeatSampleApp/src/main/java/com/ooyala/sample/MainActivity.java b/HeartbeatSampleApp/src/main/java/com/ooyala/sample/MainActivity.java new file mode 100644 index 000000000..7d8d1ac19 --- /dev/null +++ b/HeartbeatSampleApp/src/main/java/com/ooyala/sample/MainActivity.java @@ -0,0 +1,209 @@ +package com.ooyala.sample; + +import android.app.ActionBar; +import android.content.res.Configuration; +import android.media.MediaPlayer; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.MediaController; + +import com.android.volley.AuthFailureError; +import com.android.volley.Request; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.StringRequest; + +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.Map; + +public class MainActivity extends AppCompatActivity implements MediaPlayer.OnCompletionListener, + MediaPlayer.OnPreparedListener, SimpleVideoView.EventListener { + + + private final int FREQUENCY_MS = 10000; + private final int FREQUENCY_S = FREQUENCY_MS / 1000; + private final String PLAY_TIME = "PLAY_TIME"; + + private int playTime = 0; + private Handler mHandler = null; + private HandlerThread mHandlerThread = null; + private SimpleVideoView videoView; + private boolean isHandlerRunning = false; + private Runnable runnable = new Runnable() { + @Override + public void run() { + mHandler.postDelayed(this, FREQUENCY_MS); + postDataToHeartbeat(); + } + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + videoView = findViewById(R.id.videoView); + + // Check whether we're recreating a previously destroyed instance + if (savedInstanceState != null) { + playTime = savedInstanceState.getInt(PLAY_TIME); + } + } + + @Override + protected void onResume() { + super.onResume(); + fullScreenOnLandscape(); + startVideoView(); + } + + @Override + protected void onPause() { + disconnect(); + super.onPause(); + } + + @Override + public void onSaveInstanceState(Bundle savedInstanceState) { + savedInstanceState.putInt(PLAY_TIME, videoView.getCurrentPosition()); + super.onSaveInstanceState(savedInstanceState); + } + + + @Override + public void onPrepared(MediaPlayer mp) { + + } + + @Override + public void onCompletion(MediaPlayer mp) { + postDataToHeartbeat(); + disconnect(); + } + + @Override + public void onVideoPlay() { + connect(); + } + + @Override + public void onVideoPause() { + disconnect(); + } + + @Override + public void onSeekTo(int msec) { + + } + + private void connect() { + if(!isHandlerRunning) { + postDataToHeartbeat(); + } + startRecurringHandler(); + } + + private void disconnect() { + if(mHandler == null) { + return; + } + mHandler.removeCallbacks(runnable); + mHandler = null; + mHandlerThread = null; + isHandlerRunning = false; + } + + public void startRecurringHandler(){ + if(isHandlerRunning) { + return; + } + mHandlerThread = new HandlerThread("HeartbeatHandler"); + mHandlerThread.start(); + mHandler = new Handler(mHandlerThread.getLooper()); + mHandler.postDelayed(runnable, FREQUENCY_MS); + isHandlerRunning = true; + } + + + public void postDataToHeartbeat() { + String embedCode = "ltZ3l5YjE6lUAvBdflvcDQ-zti8q8Urd"; + String uuid = "HeartbeatSampleTest"; + String url ="http://ssai.ooyala.com/v1/vod_playback_pos/" + embedCode + "?ssai_guid=" + uuid; + + StringRequest sr = new StringRequest(Request.Method.POST, url, new Response.Listener() { + @Override + public void onResponse(String response) { + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + } + }) { + @Override + public byte[] getBody() throws AuthFailureError { + Map params = new HashMap<>(); + int positionSeconds = videoView.getCurrentPosition() / 1000; + params.put("playheadpos", positionSeconds); + params.put("pingfrequency", FREQUENCY_S); + return new JSONObject(params).toString().getBytes(); + } + + @Override + public String getBodyContentType() { + return "application/json"; + } + }; + + NetworkSingleton.getInstance(getApplicationContext()).addToRequestQueue(sr); + } + + private void fullScreenOnLandscape() { + View decorView = getWindow().getDecorView(); + int uiOptions; + + if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { + // Hide the status bar. + uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; + ActionBar actionBar = getActionBar(); + if (actionBar != null) { + actionBar.hide(); + } + } + else { + uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; + } + decorView.setSystemUiVisibility(uiOptions); + } + + private void startVideoView() { + MediaController mediaController = new MediaController(this); + mediaController.setAnchorView(videoView); + String baseUrl = "http://ssai.ooyala.com/vhls/ltZ3l5YjE6lUAvBdflvcDQ-zti8q8Urd/RpOWUyOq86gFq-STNqpgzhzIcXHV/eyJvIjoiaHR0cDovL3BsYXllci5vb3lhbGEuY29tL3BsYXllci9hbGwvbHRaM2w1WWpFNmxVQXZCZGZsdmNEUS16dGk4cThVcmQubTN1OD90YXJnZXRCaXRyYXRlPTEyMDAmc2VjdXJlX2lvc190b2tlbj1hMWRCYWtoSVFreHNMMFJqT0ZsUFlVZ3hNRFZLTVdSNWEwbDBaSFE0VW5SVFEzWnZVM041UVdsNGRXcFFVRFpXV0VOVVUycFVUazFQTHpWb0NuVnZWM2RoVUVGR2NIUTJjbGhTVmtOYVJIaFRXRkYxUkVaM1BUMEsiLCJlIjoiMTQ5OTQ0Mjg5MiIsInMiOiJHQk9wZFhGNGNzZzhfTzJ3MVlyU2VFejVlQzhQY0h5c054LU5FRDk3cmxzPSJ9/manifest.m3u8?ssai_guid="; + String SSAI_GUID = "HeartbeatSampleTest"; + Uri uri = Uri.parse(baseUrl + SSAI_GUID); + videoView.setMediaController(mediaController); + videoView.setVideoURI(uri); + videoView.requestFocus(); + videoView.setOnCompletionListener(this); + videoView.setOnPreparedListener(this); + videoView.setEventListener(this); + + // Check whether we're recreating a previously destroyed instance + if (playTime != 0) { + videoView.seekTo(playTime); + videoView.start(); + } + else { + // Show a frame + videoView.seekTo(60); + } + } +} + + diff --git a/HeartbeatSampleApp/src/main/java/com/ooyala/sample/NetworkSingleton.java b/HeartbeatSampleApp/src/main/java/com/ooyala/sample/NetworkSingleton.java new file mode 100644 index 000000000..5b899e011 --- /dev/null +++ b/HeartbeatSampleApp/src/main/java/com/ooyala/sample/NetworkSingleton.java @@ -0,0 +1,39 @@ +package com.ooyala.sample; + + +import android.content.Context; + +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.toolbox.Volley; + +public class NetworkSingleton { + private static NetworkSingleton mInstance; + private RequestQueue mRequestQueue; + private static Context mContext; + + private NetworkSingleton(Context context) { + mContext = context; + mRequestQueue = getRequestQueue(); + } + + public static synchronized NetworkSingleton getInstance(Context context) { + if (mInstance == null) { + mInstance = new NetworkSingleton(context); + } + return mInstance; + } + + public RequestQueue getRequestQueue() { + if (mRequestQueue == null) { + // getApplicationContext() is key, it keeps you from leaking the + // Activity or BroadcastReceiver if someone passes one in. + mRequestQueue = Volley.newRequestQueue(mContext.getApplicationContext()); + } + return mRequestQueue; + } + + public void addToRequestQueue(Request req) { + getRequestQueue().add(req); + } +} \ No newline at end of file diff --git a/HeartbeatSampleApp/src/main/java/com/ooyala/sample/SimpleVideoView.java b/HeartbeatSampleApp/src/main/java/com/ooyala/sample/SimpleVideoView.java new file mode 100644 index 000000000..bc60cdf3c --- /dev/null +++ b/HeartbeatSampleApp/src/main/java/com/ooyala/sample/SimpleVideoView.java @@ -0,0 +1,59 @@ +package com.ooyala.sample; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.VideoView; + + +public class SimpleVideoView extends VideoView { + + private EventListener mEventListener; + private int mVideoWidth; + private int mVideoHeight; + + public SimpleVideoView(Context context) { + super(context); + } + + public SimpleVideoView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public SimpleVideoView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public void setEventListener(EventListener listener) { + mEventListener = listener; + } + + @Override + public void start() { + super.start(); + if(mEventListener != null) { + mEventListener.onVideoPlay(); + } + } + + @Override + public void pause() { + super.pause(); + if(mEventListener != null) { + mEventListener.onVideoPause(); + } + } + + @Override + public void seekTo(int msec) { + super.seekTo(msec); + if(mEventListener != null) { + mEventListener.onSeekTo(msec); + } + } + + public interface EventListener { + void onVideoPlay(); + void onVideoPause(); + void onSeekTo(int msec); + } +} diff --git a/HeartbeatSampleApp/src/main/res/drawable-v24/ic_launcher_foreground.xml b/HeartbeatSampleApp/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 000000000..c7bd21dbd --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/HeartbeatSampleApp/src/main/res/drawable/ic_launcher_background.xml b/HeartbeatSampleApp/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 000000000..d5fccc538 --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HeartbeatSampleApp/src/main/res/layout/activity_main.xml b/HeartbeatSampleApp/src/main/res/layout/activity_main.xml new file mode 100644 index 000000000..2d845ca37 --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/layout/activity_main.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/HeartbeatSampleApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/HeartbeatSampleApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000..eca70cfe5 --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/HeartbeatSampleApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/HeartbeatSampleApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 000000000..eca70cfe5 --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/HeartbeatSampleApp/src/main/res/mipmap-hdpi/ic_launcher.png b/HeartbeatSampleApp/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..a2f590828 Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-hdpi/ic_launcher_round.png b/HeartbeatSampleApp/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 000000000..1b5239980 Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-mdpi/ic_launcher.png b/HeartbeatSampleApp/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..ff10afd6e Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-mdpi/ic_launcher_round.png b/HeartbeatSampleApp/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 000000000..115a4c768 Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-xhdpi/ic_launcher.png b/HeartbeatSampleApp/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..dcd3cd808 Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/HeartbeatSampleApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 000000000..459ca609d Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-xxhdpi/ic_launcher.png b/HeartbeatSampleApp/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..8ca12fe02 Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/HeartbeatSampleApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..8e19b410a Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/HeartbeatSampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..b824ebdd4 Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/HeartbeatSampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/HeartbeatSampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..4c19a13c2 Binary files /dev/null and b/HeartbeatSampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/HeartbeatSampleApp/src/main/res/values/colors.xml b/HeartbeatSampleApp/src/main/res/values/colors.xml new file mode 100644 index 000000000..bcce89e91 --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/values/colors.xml @@ -0,0 +1,7 @@ + + + #3F51B5 + #000000 + #FF4081 + #212121 + diff --git a/HeartbeatSampleApp/src/main/res/values/strings.xml b/HeartbeatSampleApp/src/main/res/values/strings.xml new file mode 100644 index 000000000..da787078a --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + OoyalaHeartbeatSampleApp + diff --git a/HeartbeatSampleApp/src/main/res/values/styles.xml b/HeartbeatSampleApp/src/main/res/values/styles.xml new file mode 100644 index 000000000..0eb88fe33 --- /dev/null +++ b/HeartbeatSampleApp/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/IMASampleApp/app/build.gradle b/IMASampleApp/app/build.gradle index 8b75dd700..4c22544cb 100644 --- a/IMASampleApp/app/build.gradle +++ b/IMASampleApp/app/build.gradle @@ -23,7 +23,7 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaIMASDK-Android/OoyalaIMASDK.jar') from new File(vendorDir, 'Google/ima-android-v374.jar') into new File(projectDir, './libs') @@ -35,12 +35,12 @@ task copyTask(type: Copy) { tasks.copyTask.execute() dependencies { - implementation 'com.google.android.gms:play-services-ads:10.0.1' + 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:r2.5.3' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation files('libs/OoyalaIMASDK.jar') - implementation files('libs/OoyalaSDK.jar') + implementation files('libs/OoyalaSDK.aar') implementation files('libs/ima-android-v374.jar') } diff --git a/IMASampleApp/build.gradle b/IMASampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/IMASampleApp/build.gradle +++ b/IMASampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/NPAWSampleApp/app/build.gradle b/NPAWSampleApp/app/build.gradle index c7d8ce4e3..207729d68 100644 --- a/NPAWSampleApp/app/build.gradle +++ b/NPAWSampleApp/app/build.gradle @@ -20,7 +20,7 @@ android { task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'NPAW/YouboraLib-5.3.1.jar') from new File(vendorDir, 'NPAW/YouboraPluginOoyala-5.3.0.jar') into new File(projectDir, './libs') @@ -32,10 +32,10 @@ task copyTask(type: Copy) { tasks.copyTask.execute() dependencies { - implementation 'com.google.android.gms:play-services-ads:10.0.1' - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation 'com.google.android.gms:play-services-ads:12.0.0' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation 'com.android.support:appcompat-v7:26.1.0' - implementation files('libs/OoyalaSDK.jar') + implementation files('libs/OoyalaSDK.aar') implementation files('libs/YouboraLib-5.3.1.jar') implementation files('libs/YouboraPluginOoyala-5.3.0.jar') } diff --git a/NPAWSampleApp/build.gradle b/NPAWSampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/NPAWSampleApp/build.gradle +++ b/NPAWSampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/NielsenSampleApp/app/build.gradle b/NielsenSampleApp/app/build.gradle index 30fb23aad..be03a00ad 100644 --- a/NielsenSampleApp/app/build.gradle +++ b/NielsenSampleApp/app/build.gradle @@ -23,8 +23,8 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') - from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') + from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaNielsenSDK-Android/OoyalaNielsenSDK.jar') from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/react-native-0.33.0.aar') @@ -69,11 +69,11 @@ repositories { } dependencies { - implementation 'com.google.android.gms:play-services-ads:10.0.1' - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation 'com.google.android.gms:play-services-ads:12.0.0' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation files('libs/OoyalaNielsenSDK.jar') - implementation files('libs/OoyalaSDK.jar') - implementation files('libs/OoyalaSkinSDK.jar') + implementation files('libs/OoyalaSDK.aar') + implementation files('libs/OoyalaSkinSDK.aar') implementation files('libs/appsdk.jar') implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:recyclerview-v7:26.1.0' diff --git a/NielsenSampleApp/build.gradle b/NielsenSampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/NielsenSampleApp/build.gradle +++ b/NielsenSampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/OmnitureSampleApp/app/build.gradle b/OmnitureSampleApp/app/build.gradle index fc389ebdd..b2737282c 100644 --- a/OmnitureSampleApp/app/build.gradle +++ b/OmnitureSampleApp/app/build.gradle @@ -24,11 +24,11 @@ android { } task copyLibs(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaAdobeAnalyticsSDK-Android/OoyalaAdobeAnalyticsSDK.jar') from new File(vendorDir, 'Adobe/AdobeMobile/AdobeMobileLibrary-4.9.0.jar') from new File(vendorDir, 'Adobe/Heartbeat/VideoHeartbeat-1.5.6.jar') - from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/react-native-0.35.0.aar') into 'libs' doLast { @@ -66,8 +66,8 @@ repositories { } dependencies { - implementation files('libs/OoyalaSDK.jar') - implementation files('libs/OoyalaSkinSDK.jar') + implementation files('libs/OoyalaSDK.aar') + implementation files('libs/OoyalaSkinSDK.aar') implementation files('libs/OoyalaAdobeAnalyticsSDK.jar') implementation files('libs/AdobeMobileLibrary-4.9.0.jar') implementation files('libs/VideoHeartbeat-1.5.6.jar') diff --git a/OmnitureSampleApp/build.gradle b/OmnitureSampleApp/build.gradle index a9746a7dc..29ccb4eae 100644 --- a/OmnitureSampleApp/build.gradle +++ b/OmnitureSampleApp/build.gradle @@ -26,4 +26,4 @@ task clean(type: Delete) { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/OoyalaAPISampleApp/app/build.gradle b/OoyalaAPISampleApp/app/build.gradle index 52e24b35f..af044ddf2 100644 --- a/OoyalaAPISampleApp/app/build.gradle +++ b/OoyalaAPISampleApp/app/build.gradle @@ -19,7 +19,7 @@ android { } task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') into new File(projectDir, './libs') doLast { println "Jars updated." @@ -28,8 +28,8 @@ task copyTask(type: Copy) { tasks.copyTask.execute() dependencies { - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' implementation 'com.android.support:appcompat-v7:26.1.0' - implementation files('libs/OoyalaSDK.jar') + implementation files('libs/OoyalaSDK.aar') } diff --git a/OoyalaAPISampleApp/build.gradle b/OoyalaAPISampleApp/build.gradle index d9f647bfc..bd9629325 100644 --- a/OoyalaAPISampleApp/build.gradle +++ b/OoyalaAPISampleApp/build.gradle @@ -18,4 +18,4 @@ allprojects { ext { vendorDir = new File(projectDir, '../vendor') -} \ No newline at end of file +} diff --git a/OoyalaSkinSampleApp/app/build.gradle b/OoyalaSkinSampleApp/app/build.gradle index 68afad70d..489893119 100644 --- a/OoyalaSkinSampleApp/app/build.gradle +++ b/OoyalaSkinSampleApp/app/build.gradle @@ -59,10 +59,10 @@ task copyFontsAssetsTask(type: Copy) { tasks.copyFontsAssetsTask.execute() task copyTask(type: Copy) { - from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.jar') + from new File(vendorDir, 'Ooyala/OoyalaSDK-Android/OoyalaSDK.aar') from new File(vendorDir, 'Ooyala/OoyalaIMASDK-Android/OoyalaIMASDK.jar') from new File(vendorDir, 'Ooyala/OoyalaFreewheelSDK-Android/OoyalaFreewheelSDK.jar') - from new File(vendorDir, 'Ooyala/OoyalaSkinSDK-Android/OoyalaSkinSDK.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, 'Ooyala/OoyalaSkinSDK-Android/react-native-0.35.0.aar') @@ -83,12 +83,12 @@ dependencies { implementation files('libs/FWAdManager.jar') implementation files('libs/OoyalaFreewheelSDK.jar') implementation files('libs/OoyalaIMASDK.jar') - implementation files('libs/OoyalaSDK.jar') + implementation files('libs/OoyalaSDK.aar') implementation files('libs/ima-android-v374.jar') - implementation files('libs/OoyalaSkinSDK.jar') + implementation files('libs/OoyalaSkinSDK.aar') - implementation 'com.google.android.exoplayer:exoplayer:r2.5.3' - implementation 'com.google.android.gms:play-services-ads:10.0.1' + implementation 'com.google.android.exoplayer:exoplayer:2.6.1' + implementation 'com.google.android.gms:play-services-ads:12.0.0' implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'com.facebook.fresco:fresco:0.11.0' @@ -103,7 +103,7 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1' implementation 'com.squareup.okio:okio:1.9.0' implementation 'org.webkit:android-jsc:r174650' - implementation(name:'react-native', version:'0.35.0', ext:'aar') + implementation(group:'com.facebook', name:'react-native', version:'0.35.0', ext:'aar') implementation 'javax.inject:javax.inject:1' } diff --git a/OoyalaSkinSampleApp/app/src/main/AndroidManifest.xml b/OoyalaSkinSampleApp/app/src/main/AndroidManifest.xml index 7e4230945..6734c5baf 100644 --- a/OoyalaSkinSampleApp/app/src/main/AndroidManifest.xml +++ b/OoyalaSkinSampleApp/app/src/main/AndroidManifest.xml @@ -68,6 +68,27 @@ + + + + + + + + + + + + + diff --git a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/complete/MainActivity.java b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/complete/MainActivity.java index 98e323247..6bfa0e1f5 100644 --- a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/complete/MainActivity.java +++ b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/complete/MainActivity.java @@ -13,7 +13,9 @@ import com.ooyala.sample.lists.FreewheelListActivity; import com.ooyala.sample.lists.GeoBlockingListActivity; import com.ooyala.sample.lists.IMAListActivity; +import com.ooyala.sample.lists.MultiAudioListActivity; import com.ooyala.sample.lists.OoyalaSkinListActivity; +import com.ooyala.sample.lists.ScreenshotListActivity; import com.ooyala.sample.players.AssetActivity; import com.ooyala.sample.players.ResizablePlayerActivity; @@ -52,6 +54,8 @@ protected void onCreate(Bundle savedInstanceState) { activityMap.put(AssetActivity.getName(), AssetActivity.class); activityMap.put(ResizablePlayerActivity.getName(), ResizablePlayerActivity.class); activityMap.put(GeoBlockingListActivity.getName(), GeoBlockingListActivity.class); + activityMap.put(ScreenshotListActivity.getName(), ScreenshotListActivity.class); + activityMap.put(MultiAudioListActivity.getName(), MultiAudioListActivity.class); for(String key : activityMap.keySet()) { mainListAdapter.add(key); diff --git a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/lists/MultiAudioListActivity.java b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/lists/MultiAudioListActivity.java new file mode 100644 index 000000000..006695aa8 --- /dev/null +++ b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/lists/MultiAudioListActivity.java @@ -0,0 +1,171 @@ +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.MultiAudioActivity; +import com.ooyala.sample.utils.PlayerSelectionOption; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class MultiAudioListActivity extends Activity implements OnItemClickListener { + + public final static String getName() { + return MultiAudioListActivity.class.getSimpleName(); + } + + private static Map selectionMap; + private ArrayAdapter selectionAdapter; + + /** + * Called when the activity is first created. + */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setTitle(getName()); + selectionMap = new LinkedHashMap<>(); + + String pcode = "BzY2syOq6kIK6PTXN7mmrGVSJEFj"; + String domain = "http://www.ooyala.com"; + + selectionMap = new LinkedHashMap<>(); + selectionMap.put("1 track + No CC", new PlayerSelectionOption("c0YzVwZTE6mYDzgMMYwoB_bWgD7XB3P-", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Several tracks + No CC", new PlayerSelectionOption("c3cGZwZTE6lh5w1Jm6hK0LAEpP_EKn-6", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("1 track + CC", new PlayerSelectionOption("92cmZwZTE613kYlorJkkSJXAw4DnFRxv", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Several tracks + CC", new PlayerSelectionOption("E4bDRwZTE6rMB8oYrzOsuHSPz0XM0dAV", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Change Track", new PlayerSelectionOption("c3cGZwZTE6lh5w1Jm6hK0LAEpP_EKn-6", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Change CC", new PlayerSelectionOption("E4bDRwZTE6rMB8oYrzOsuHSPz0XM0dAV", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("DASH", new PlayerSelectionOption("tyOTBvZTE6Gq2ib-GtRchnRCQmk3jLRT", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("HLS", new PlayerSelectionOption("tsYjVwZTE6zgfSBx4_gvsVuFuwy844q_", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("7+ tracks + CC", new PlayerSelectionOption("p5amdwZTE6NgCrrm18YoUTrgJsI7D26f", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Mid-roll", new PlayerSelectionOption("FrZGVyZTE6Bv2s5QwtytNT48VJfq9vdh", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Post-roll", new PlayerSelectionOption("ppZGVyZTE6dX1q1yTHtygM4lyiRwDFDM", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("MP4 without CC", new PlayerSelectionOption("g0Z2hwZTE6i-ODpQETJqhOCt2jOE6Y2c", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("MP4 with CC", new PlayerSelectionOption("xkaGhwZTE6hghIcejjoTfu0BG2sLdtxp", pcode, domain, MultiAudioActivity.class)); + + selectionMap.put("Azure Clear HLS Var1", new PlayerSelectionOption("F0YnhyZTE64tQDm5QMdcpjp_hMI8Xqya", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM HLS Var1", new PlayerSelectionOption("FtY3hyZTE6_YTA3Q8SohK9KYIeSAEVl3", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain,MultiAudioActivity.class)); + selectionMap.put("Azure Clear DASH Var1", new PlayerSelectionOption("ppZXhyZTE6uIA15GG6E2CmJvzFgA8bvl", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM DASH Var1", new PlayerSelectionOption("h3ZXhyZTE6ATBTgah1HUOrCx5S2i2NNe", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure eHLS Var1", new PlayerSelectionOption("8wMnhyZTE6i6Y54Sz9X7T2f3oT5LU7sq", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure Clear HLS/DASH Var1", new PlayerSelectionOption("I1bXdyZTE6KCZ9ByP8oc7wxzmnPciIYP", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure fpts/DASH DRM Var1", new PlayerSelectionOption("V3MHhyZTE65obsJsmfRV8-OP1nqyOJqP", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Azure Clear HLS Var1-copy", new PlayerSelectionOption("M1YnhyZTE6X6-QO5AmLg1f623BYEDioW", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM HLS Var1-copy", new PlayerSelectionOption("k5ZHhyZTE60bYC8uPfP75GoENXPWa-f_", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain,MultiAudioActivity.class)); + selectionMap.put("Azure Clear DASH Var1-copy", new PlayerSelectionOption("ZuZHhyZTE6bGxbwDy9zN5zRvFlHydgky", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM DASH Var1-copy", new PlayerSelectionOption("hmZnhyZTE6nkRmjIZjBZF5fuEjXxR4D4", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure eHLS Var1-copy", new PlayerSelectionOption("gzM3hyZTE6FYgJOHmTfEu0gJTGTNEzjw", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure Clear HLS/DASH Var1-copy", new PlayerSelectionOption("hwcXdyZTE6FLIL9U0UwZeHblMZ_CidXI", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure fpts/DASH DRM Var1-copy", new PlayerSelectionOption("ZzdndyZTE6xbnLFc9zFQpVeZhu2M-JtF", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Azure Clear HLS Var2", new PlayerSelectionOption("43bnhyZTE64pp4S7s2Ip59h9-u0Tf38R", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM HLS Var2", new PlayerSelectionOption("dzbXhyZTE6tHVS5qvVQz0ftWGYta-x4F", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain,MultiAudioActivity.class)); + selectionMap.put("Azure Clear DASH Var2", new PlayerSelectionOption("pla3hyZTE670TKlBa0Yoa--Pcp_3PHkH", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM DASH Var2", new PlayerSelectionOption("ByanhyZTE6CxieRrvQ7dDfz43R3-CRkc", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure eHLS Var2", new PlayerSelectionOption("1jb3hyZTE6WpUyiXBv-51xhsM_vsoVNi", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure Clear HLS/DASH Var2", new PlayerSelectionOption("sydXhyZTE6TLCs-wSUnJ2485uGRRJGB1", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure fpts/DASH DRM Var2", new PlayerSelectionOption("g1cHhyZTE6khrdWCRZXgwf4wRvqgZ701", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Azure Clear HLS Var2-copy", new PlayerSelectionOption("NubnhyZTE6pyMfC0JDjxd5c4Ge5Tpb7t", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM HLS Var2-copy", new PlayerSelectionOption("ljbXhyZTE6gNwjO0MEWyVm6a9k6JoDuK", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain,MultiAudioActivity.class)); + selectionMap.put("Azure Clear DASH Var2-copy", new PlayerSelectionOption("xobHhyZTE6p6DIACBCyGLPhWpX6kIEPO", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM DASH Var2-copy", new PlayerSelectionOption("03anhyZTE6Sg9I6qwgV4m2n_wh5Z9WsZ", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure eHLS Var2-copy", new PlayerSelectionOption("4yb3hyZTE6x8VOh3aPPDHk8lJskxaS07", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure Clear HLS/DASH Var2-copy", new PlayerSelectionOption("55c3hyZTE6o0K1AiasoFiOmUd2Mmo_x0", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure fpts/DASH DRM Var2-copy", new PlayerSelectionOption("lucHhyZTE6qO0F6nIckIAKoZJZxQATpr", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Azure Clear HLS Var5", new PlayerSelectionOption("p1eXhyZTE6qeKu5YljlqjIvtnlvkWig4", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM HLS Var5", new PlayerSelectionOption("Z0MHlyZTE6vRDsTlYedKM3DNYga6EaX8", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain,MultiAudioActivity.class)); + selectionMap.put("Azure Clear DASH Var5", new PlayerSelectionOption("5hMXlyZTE6Xymmf1HTLOCRITvBp_ysk1", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM DASH Var5", new PlayerSelectionOption("xmMnlyZTE6PxtdbxL6jvECG2v6J7U99K", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure eHLS Var5", new PlayerSelectionOption("xyeHhyZTE6L_DdyHGh06RQNHxwvpLg37", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure Clear HLS/DASH Var5", new PlayerSelectionOption("J0dnhyZTE6jxN699wKmxLB5GfSB-kt0K", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure fpts/DASH DRM Var5", new PlayerSelectionOption("YzeHhyZTE6JYi37FwBsbIae7ozD7T-Xf", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Azure Clear HLS Var5-copy", new PlayerSelectionOption("c3MHlyZTE6kUd0xoMGG2LA6sbmM3HMrI", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM HLS Var5-copy", new PlayerSelectionOption("VmMHlyZTE6qbE17I3XOhy6MgsWhTfAup", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain,MultiAudioActivity.class)); + selectionMap.put("Azure Clear DASH Var5-copy", new PlayerSelectionOption("Z3MXlyZTE6wLcXll9l-OTo0JVbu5G3vB", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure DRM DASH Var5-copy", new PlayerSelectionOption("o1MnlyZTE6A2GxgCRw3JMgFtcvP4IFaQ", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure eHLS Var5-copy", new PlayerSelectionOption("o2eXhyZTE6WtQVY1rlNyYvDGT1PW7OaZ", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure Clear HLS/DASH Var5-copy", new PlayerSelectionOption("9jd3hyZTE6Ybqbo_VsYHEpvUlJg21pQx", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Azure fpts/DASH DRM Var5-copy", new PlayerSelectionOption("Vnd3hyZTE6i6cwJPa46i2ge1Ao28Xgh-", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Elemental HLS MT-Variant-1", new PlayerSelectionOption("9oc3ZzZTE6rkpKJVCyGg_vFSWTQ5LOUB", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH MT-Variant-1", new PlayerSelectionOption("p4c3ZzZTE6SFvgjVPd1hXX3YfjOpJAhu", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental eHLS MT-Variant-1", new PlayerSelectionOption("E4dHZzZTE6-5aCf147EC-uqRTkucqKWB", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH&HLS MT-Variant-1", new PlayerSelectionOption("1pdHZzZTE6Wuz26flXA1i-hP-uPv2Hjh", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Elemental HLS MT-Variant-2", new PlayerSelectionOption("8wdnZzZTE68i13f1fEuC_FnRaMGw0hS1", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH MT-Variant-2", new PlayerSelectionOption("JqdXZzZTE60dB_qoVJfwbJCgEZcBcget", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental eHLS MT-Variant-2", new PlayerSelectionOption("84dnZzZTE6BRpY86hFPpUKWjN6BqVPJr", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH&HLS MT-Variant-2", new PlayerSelectionOption("AzdXZzZTE6R1nkl0ATTLv1krq-OX4RDZ", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Elemental HLS MT-Variant-2copy", new PlayerSelectionOption("11Y3lzZTE6lyIUF6bbYSBPEHWkjTFpow", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH MT-Variant-2copy", new PlayerSelectionOption("80Z3lzZTE6Ga-FWBY2VGEkRxyjbvq79s", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental eHLS MT-Variant-2copy", new PlayerSelectionOption("h2ZHlzZTE6-YQJIitmIV5RwlJBWHOwKa", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH&HLS MT-Variant-2copy", new PlayerSelectionOption("9kZnlzZTE6us2h0_rfFGcIdLYSyNGRU5", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Elemental HLS MT-Variant-6", new PlayerSelectionOption("kzd3ZzZTE6OtnaIbZKlPL5agHYNKS2cq", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH MT-Variant-6", new PlayerSelectionOption("F1dnZzZTE6IHFms28cye2csu9RGn4Wpp", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental eHLS MT-Variant-6", new PlayerSelectionOption("tpdnZzZTE6qe66Fn558NrjrGBfiNbY3r", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH&HLS MT-Variant-6", new PlayerSelectionOption("1xdnZzZTE6mhDfTDBDfGZf6LcftUdRRI", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Elemental HLS MT-Variant-6copy", new PlayerSelectionOption("RyMDB0ZTE63oqMajyUgE1P0QKR6mln2E", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH MT-Variant-6copy", new PlayerSelectionOption("d2YTB0ZTE6sNL25zSPLd_Osiq2d1gKUo", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental eHLS MT-Variant-6copy", new PlayerSelectionOption("4zNDB0ZTE63Dup-47FIZKwBJUn7DRSST", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH&HLS MT-Variant-6copy", new PlayerSelectionOption("FtOTB0ZTE6zQl3KyGyGmhrHpYfTtfoRC", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + selectionMap.put("Elemental HLS MT-Variant-5", new PlayerSelectionOption("xmMXdzZTE6Bydd2tPBEOg-q5yvQgjebE", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH MT-Variant-5", new PlayerSelectionOption("N3MndzZTE6lNdlnQqZ4CxK8TgQIj_7Qf", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental eHLS MT-Variant-5", new PlayerSelectionOption("ViNXdzZTE6CxtLfMiTQH4Me8jz-p2cbS", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + selectionMap.put("Elemental DASH&HLS MT-Variant-5", new PlayerSelectionOption("o0NHdzZTE6xc6g06MbXie5f9oXtPYbzR", "k0a2gyOt0QGNJLSuzKfdY4R-hw2b", domain, MultiAudioActivity.class)); + + pcode = "k0a2gyOt0QGNJLSuzKfdY4R-hw2b"; + selectionMap.put("English/German tracks", new PlayerSelectionOption("wxNjRwZTE6bxMBkrQbfM_BwokGf0pyOm", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Undefined/Undefined asset1", new PlayerSelectionOption("xmaTRwZTE6lCuPd3H82AteBFUvNHtrHu", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Undefined/Undefined asset2", new PlayerSelectionOption("Y1cTRwZTE6Mc47fc_8n161HVYQYu5l0d", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("No config Eng main+commentary/Ger main+commentary", new PlayerSelectionOption("txcjRwZTE6aMSqloxZZ3hZhTqz5hEaY9", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Config Eng main+commentary/Ger main+commentary", new PlayerSelectionOption("EweDRwZTE6ipjPDynkEotrpTvvYgDvr7", pcode, domain, MultiAudioActivity.class)); + selectionMap.put("Mixed language code/Undefined", new PlayerSelectionOption("o3eTRwZTE6TBJnp6gPJia25dtOcrugUk", pcode, domain, MultiAudioActivity.class)); + + setContentView(R.layout.list_activity_layout); + + //Create the adapter for the ListView + selectionAdapter = new ArrayAdapter(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 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("selection_name", selectionAdapter.getItem(pos)); + intent.putExtra("pcode", selection.getPcode()); + intent.putExtra("domain", selection.getDomain()); + startActivity(intent); + return; + } +} diff --git a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/lists/ScreenshotListActivity.java b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/lists/ScreenshotListActivity.java new file mode 100644 index 000000000..cd2b6e246 --- /dev/null +++ b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/lists/ScreenshotListActivity.java @@ -0,0 +1,94 @@ +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.ScreenshotActivity; +import com.ooyala.sample.utils.PlayerSelectionOption; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class ScreenshotListActivity extends Activity implements OnItemClickListener { + + public final static String getName() { + return ScreenshotListActivity.class.getSimpleName(); + } + + private static Map selectionMap; + private ArrayAdapter selectionAdapter; + + /** + * Called when the activity is first created. + */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setTitle(getName()); + + selectionMap = new LinkedHashMap(); + selectionMap.put("4:3 Aspect Ratio", new PlayerSelectionOption("FwaXZjcjrkydIftLal2cq9ymQMuvjvD8", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put( "MP4 Video", new PlayerSelectionOption("h4aHB1ZDqV7hbmLEv4xSOx3FdUUuephx", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class) ); + selectionMap.put( "HLS Video", new PlayerSelectionOption("Y1ZHB1ZDqfhCPjYYRbCEOz0GR8IsVRm1", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class) ); + selectionMap.put( "Ooyala Encrypted HLS", new PlayerSelectionOption("ZtZmtmbjpLGohvF5zBLvDyWexJ70KsL-", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class) ); + selectionMap.put( "VOD with CCs", new PlayerSelectionOption("92cWp0ZDpDm4Q8rzHfVK6q9m6OtFP-ww", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class) ); + selectionMap.put( "Clear HLS High Profile", new PlayerSelectionOption("FlNXNsMjE6SvZO6iFmPgfXhG_PKX1yTJ", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class) ); + selectionMap.put( "Clear HLS Main Profile", new PlayerSelectionOption("42cnNsMjE62UDH0JlCssXEPhxlhj1YBN", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class) ); + selectionMap.put( "Clear HLS Baseline", new PlayerSelectionOption("V5ZnNsMjE6NRd7hfQYZibvDufNgB_233", "c0cTkxOqALQviQIGAHWY5hP0q9gU", "http://www.ooyala.com", ScreenshotActivity.class) ); + + selectionMap.put("VAST2 Ad Pre-roll", new PlayerSelectionOption("Zlcmp0ZDrpHlAFWFsOBsgEXFepeSXY4c", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VAST2 Ad Mid-roll", new PlayerSelectionOption("pncmp0ZDp7OKlwTPJlMZzrI59j8Imefa", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VAST2 Ad Post-roll", new PlayerSelectionOption("Zpcmp0ZDpaB-90xK8MIV9QF973r1ZdUf", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VAST2 Ad Wrapper", new PlayerSelectionOption("5ybGV3ZTrqvbymwBC6ThtupFBptOp1rP", "IxMWwxOtIoprfDnNvx0aBd97TcIk", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("Ooyala Ad Pre-roll", new PlayerSelectionOption("M4cmp0ZDpYdy8kiL4UD910Rw_DWwaSnU", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("Ooyala Ad Mid-roll", new PlayerSelectionOption("xhcmp0ZDpnDB2-hXvH7TsYVQKEk_89di", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("Ooyala Ad Post-roll", new PlayerSelectionOption("Rjcmp0ZDr5yFbZPEfLZKUveR_2JzZjMO", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("Multi Ad combination", new PlayerSelectionOption("Ftcmp0ZDoz8tALmhPcN2vMzCdg7YU9lc", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + + selectionMap.put("VAST 3.0 2 Podded Ad", new PlayerSelectionOption("tjN2h1MDE65xMHMqNvvU0fYVBi6sFl1M", "ltOGIyOq4Waxz7r-q6FsUpEfl4dg", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VAST 3.0 Ad With All Of The New Events", new PlayerSelectionOption("x3MWp1MDE6yIedkirT0to1t1uy2oA8y3", "ltOGIyOq4Waxz7r-q6FsUpEfl4dg", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VAST 3.0 Ad With Icon", new PlayerSelectionOption("1qNGp1MDE6GBl7PkPlWA_FA9NJDhBp_I", "ltOGIyOq4Waxz7r-q6FsUpEfl4dg", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VAST 3.0 Skippable Ad Long", new PlayerSelectionOption("55MjA5MTE6iZTRzrTtLoxUy78YbffT2G", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VAST 3.0 Ad Wrapper", new PlayerSelectionOption("Fkcm9lMjE6GOcDOtPSiRnNCRhqsz-96e", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + + selectionMap.put("VMAP PreMidPost Single", new PlayerSelectionOption("41MzA5MTE65SC6VQAS3H3d9rX-hwHQSK", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + selectionMap.put("VMAP PreMid VASTAdData", new PlayerSelectionOption("10eGE0MjE6TZG6mdHfJJEAGnxbuEv1Vi", "BidTQxOqebpNk1rVsjs2sUJSTOZc", "http://www.ooyala.com", ScreenshotActivity.class)); + + setContentView(R.layout.list_activity_layout); + + //Create the adapter for the ListView + selectionAdapter = new ArrayAdapter(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 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("selection_name", selectionAdapter.getItem(pos)); + intent.putExtra("pcode", selection.getPcode()); + intent.putExtra("domain", selection.getDomain()); + startActivity(intent); + return; + } +} diff --git a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/MultiAudioActivity.java b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/MultiAudioActivity.java new file mode 100644 index 000000000..5b0d291c5 --- /dev/null +++ b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/MultiAudioActivity.java @@ -0,0 +1,109 @@ +package com.ooyala.sample.players; + +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; + +import com.ooyala.android.OoyalaNotification; +import com.ooyala.android.OoyalaPlayer; +import com.ooyala.android.PlayerDomain; +import com.ooyala.android.configuration.Options; +import com.ooyala.android.imasdk.OoyalaIMAManager; +import com.ooyala.android.player.exoplayer.multiaudio.AudioTrack; +import com.ooyala.android.skin.OoyalaSkinLayoutController; +import com.ooyala.sample.R; + +import java.util.Observable; +import java.util.Set; + +/** + * This activity illustrates how you can use multi audio methods + */ +public class MultiAudioActivity extends AbstractHookActivity { + + private AudioTrack currentAudioTrack; + private Set audioTracks; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.player_skin_simple_layout); + completePlayerSetup(asked); + } + + @Override + void completePlayerSetup(boolean asked) { + if (asked) { + // Get the SkinLayout from our layout xml + skinLayout = 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(); + + player = new OoyalaPlayer(pcode, playerDomain, options); + playerLayoutController = new OoyalaSkinLayoutController(getApplication(), skinLayout, player); + + //Add observer to listen to fullscreen open and close events + playerLayoutController.addObserver(this); + player.addObserver(this); + + OoyalaIMAManager imaManager = new OoyalaIMAManager(player, skinLayout); + + if (!player.setEmbedCode(embedCode)) { + Log.e(TAG, "Asset Failure"); + } + + // Show how to set audio settings i.e. default audio language + //setAudioSettings(); + } + } + + @Override + public void update(Observable arg0, Object argN) { + super.update(arg0, argN); + final String arg1 = OoyalaNotification.getNameOrUnknown(argN); + + // MULTI_AUDIO_ENABLED_NOTIFICATION_NAME is called once on a video start. + if (arg1 == OoyalaPlayer.MULTI_AUDIO_ENABLED_NOTIFICATION_NAME) { + // This method shows how to retrieve the list of available audio tracks and + // set audio with English language. + //setAudioTrack(); + + // This method demonstrate how to obtain default audio settings. + //getDefaultAudioSettings(); + } + + // AUDIO_TRACK_SELECTED_NOTIFICATION_NAME is called when an audio track was selected. + if (arg1 == OoyalaPlayer.AUDIO_TRACK_SELECTED_NOTIFICATION_NAME) { + currentAudioTrack = player.getCurrentAudioTrack(); + } + } + + private void setAudioSettings() { + player.setDefaultAudioLanguage("eng"); + } + + private void setAudioTrack() { + audioTracks = player.getAvailableAudioTracks(); + if (audioTracks != null) { + String language = "eng"; + for (AudioTrack track : audioTracks) { + Log.d("MultiAudio activity", "MultiAudio track language is: " + track.getLanguage()); + if (TextUtils.equals(track.getLanguage(), language)) { + player.setAudioTrack(track); + break; + } + } + } + } + + private void getDefaultAudioSettings() { + AudioTrack defaultAudioTrack = player.getDefaultAudioTrack(); + String defaultAudioLanguage = player.getDefaultAudioLanguage(); + } +} diff --git a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/ResizablePlayerActivity.java b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/ResizablePlayerActivity.java index ad27bc1e6..5c06ef78b 100644 --- a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/ResizablePlayerActivity.java +++ b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/ResizablePlayerActivity.java @@ -2,7 +2,6 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; -import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -28,12 +27,6 @@ protected void onCreate(Bundle savedInstanceState) { skinPlayerFragment = (SkinPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.video_fragment); } - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { - skinPlayerFragment.onKeyDown(keyCode, event); - return super.onKeyDown(keyCode, event); - } - @Override public void invokeDefaultOnBackPressed() { super.onBackPressed(); diff --git a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/ScreenshotActivity.java b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/ScreenshotActivity.java new file mode 100644 index 000000000..b609724a6 --- /dev/null +++ b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/players/ScreenshotActivity.java @@ -0,0 +1,75 @@ +package com.ooyala.sample.players; + +import android.graphics.Bitmap; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; + +import com.ooyala.android.OoyalaPlayer; +import com.ooyala.android.PlayerDomain; +import com.ooyala.android.configuration.Options; +import com.ooyala.android.player.exoplayer.PlayerBitmapListener; +import com.ooyala.android.skin.OoyalaSkinLayout; +import com.ooyala.android.skin.OoyalaSkinLayoutController; +import com.ooyala.sample.R; + +/** + * This activity illustrates how you can create a screenshot + */ +public class ScreenshotActivity extends AbstractHookActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.player_screenshot_layout); + completePlayerSetup(asked); + + // create a bitmap + Button screenshotButton = findViewById(R.id.screenshotButton); + final ImageView screenshotView = findViewById(R.id.screenshotView); + + screenshotButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (player != null) { + player.createBitmapScreenshot(new PlayerBitmapListener() { + @Override + public void onBitmapReady(Bitmap bitmap) { + screenshotView.setImageBitmap(bitmap); + } + }); + } + } + }); + } + + @Override + void completePlayerSetup(boolean asked) { + if (asked) { + // Get the SkinLayout from our layout xml + 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(); + + player = new OoyalaPlayer(pcode, playerDomain, options); + playerLayoutController = new OoyalaSkinLayoutController(getApplication(), skinLayout, player); + + //Add observer to listen to fullscreen open and close events + playerLayoutController.addObserver(this); + player.addObserver(this); + + if (player.setEmbedCode(embedCode)) { + } else { + Log.e(TAG, "Asset Failure"); + } + } + } +} diff --git a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/utils/fragments/SkinPlayerFragment.java b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/utils/fragments/SkinPlayerFragment.java index 1b475eb2a..bac931946 100644 --- a/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/utils/fragments/SkinPlayerFragment.java +++ b/OoyalaSkinSampleApp/app/src/main/java/com/ooyala/sample/utils/fragments/SkinPlayerFragment.java @@ -6,7 +6,6 @@ import android.support.v4.app.Fragment; import android.util.Log; import android.view.Display; -import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -69,13 +68,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa return view; } - public boolean onKeyDown(int keyCode, KeyEvent event) { - if (controller != null) { - return controller.onKeyDown(keyCode, event); - } - return false; - } - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.skin_menu, menu); diff --git a/OoyalaSkinSampleApp/app/src/main/res/layout/player_screenshot_layout.xml b/OoyalaSkinSampleApp/app/src/main/res/layout/player_screenshot_layout.xml new file mode 100644 index 000000000..91ba78b8a --- /dev/null +++ b/OoyalaSkinSampleApp/app/src/main/res/layout/player_screenshot_layout.xml @@ -0,0 +1,38 @@ + + + +