-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
brightcove-exoplayer/BumperSampleApp/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.brightcove.player.samples.exoplayer.bumper" | ||
android:versionCode="1" | ||
android:versionName="1.0" > | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<!-- Required for Android TV --> | ||
<uses-feature android:name="android.software.leanback" android:required="false" /> | ||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:banner="@drawable/tv_banner" | ||
android:theme="@style/AppTheme" | ||
android:usesCleartextTraffic="true"> | ||
<activity | ||
android:name="com.brightcove.player.samples.exoplayer.bumper.MainActivity" | ||
android:screenOrientation="unspecified" | ||
android:configChanges="orientation|screenSize" | ||
android:label="@string/app_name" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
76 changes: 76 additions & 0 deletions
76
...rSampleApp/src/main/java/com/brightcove/player/samples/exoplayer/bumper/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.brightcove.player.samples.exoplayer.bumper; | ||
|
||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
||
import com.brightcove.player.bumper.BumperComponent; | ||
import com.brightcove.player.edge.Catalog; | ||
import com.brightcove.player.edge.VideoListener; | ||
import com.brightcove.player.event.EventEmitter; | ||
import com.brightcove.player.model.Video; | ||
import com.brightcove.player.view.BrightcovePlayer; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* This app illustrates how to use the ExoPlayer and the BumperComponent with the Brightcove | ||
* Native Player SDK for Android. | ||
*/ | ||
public class MainActivity extends BrightcovePlayer { | ||
|
||
private final String TAG = this.getClass().getSimpleName(); | ||
private BumperComponent bumperComponent; | ||
|
||
private Boolean useSetBumperID = true; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
// When extending the BrightcovePlayer, we must assign the brightcoveVideoView before | ||
// entering the superclass. This allows for some stock video player lifecycle | ||
// management. Establish the video object and use it's event emitter to get important | ||
// notifications and to control logging. | ||
setContentView(R.layout.activity_main); | ||
brightcoveVideoView = findViewById(R.id.brightcove_video_view); | ||
super.onCreate(savedInstanceState); | ||
|
||
// Get the event emitter from the SDK and create a catalog request to fetch a video from the | ||
// Brightcove Edge service, given a video id, an account id and a policy key. | ||
EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter(); | ||
|
||
Catalog catalog = new Catalog.Builder(eventEmitter, getString(R.string.sdk_demo_account)) | ||
.setBaseURL(Catalog.DEFAULT_EDGE_BASE_URL) | ||
.setPolicy(getString(R.string.sdk_demo_policy)) | ||
.build(); | ||
|
||
//Building the instance of the bumper component, providing the existing videoView and catalog. | ||
bumperComponent = new BumperComponent.Builder(brightcoveVideoView, catalog).build(); | ||
//Initializing the bumper. | ||
bumperComponent.init(); | ||
|
||
catalog.findVideoByID(getString(R.string.sdk_demo_videoId), new VideoListener() { | ||
// Add the video found to the queue with add(). | ||
@Override | ||
public void onVideo(Video video) { | ||
// Showcasing both options to set the bumper id manually or obtaining it from the | ||
// video object properties | ||
if (useSetBumperID) { | ||
//Manually Setting our own bumper ID | ||
bumperComponent.setVideoBumperID(getString(R.string.sdk_demo_bumper_videoId)); | ||
} else { | ||
//Obtaining the bumper id from the video custom fields | ||
Map<String, Object> customFields = | ||
(Map<String, Object>) video.getProperties().get(Video.Fields.CUSTOM_FIELDS); | ||
if ((customFields != null && !customFields.isEmpty()) && | ||
(customFields.containsKey("bumper_id"))) { | ||
bumperComponent.setVideoBumperID((String) customFields.get("bumper_id")); | ||
} | ||
} | ||
Log.v(TAG, "onVideo: video = " + video); | ||
//Adding the video | ||
brightcoveVideoView.add(video); | ||
//Autostart Playback | ||
brightcoveVideoView.start(); | ||
} | ||
}); | ||
} | ||
} |
Binary file added
BIN
+1.74 KB
brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.17 KB
brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.33 KB
brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.25 KB
brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/tv_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.6 KB
brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
brightcove-exoplayer/BumperSampleApp/src/main/res/layout/activity_main.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<merge xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
tools:context=".MainActivity" > | ||
|
||
<com.brightcove.player.view.BrightcoveExoPlayerVideoView | ||
android:id="@+id/brightcove_video_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="280dp" | ||
android:layout_gravity="center_horizontal|top"/> | ||
|
||
</merge> |
18 changes: 18 additions & 0 deletions
18
brightcove-exoplayer/BumperSampleApp/src/main/res/values/strings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<!-- Application name --> | ||
<string name="app_name">Bumper Sample App</string> | ||
|
||
<!-- A sample Brightcove Edge Account ID --> | ||
<string name="sdk_demo_account">4800266849001</string> | ||
|
||
<!-- A sample Brightcove Edge Policy Key --> | ||
<string name="sdk_demo_policy">BCpkADawqM3n0ImwKortQqSZCgJMcyVbb8lJVwt0z16UD0a_h8MpEYcHyKbM8CGOPxBRp0nfSVdfokXBrUu3Sso7Nujv3dnLo0JxC_lNXCl88O7NJ0PR0z2AprnJ_Lwnq7nTcy1GBUrQPr5e</string> | ||
|
||
<!-- A sample Brightcove Video ID --> | ||
<string name="sdk_demo_videoId">1715882712036765088</string> | ||
|
||
<!-- A sample Brightcove Bumper Video ID --> | ||
<string name="sdk_demo_bumper_videoId">1752206670195252559</string> | ||
|
||
</resources> |
20 changes: 20 additions & 0 deletions
20
brightcove-exoplayer/BumperSampleApp/src/main/res/values/styles.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<resources> | ||
|
||
<!-- | ||
Base application theme, dependent on API level. This theme is replaced | ||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices. | ||
--> | ||
<style name="AppBaseTheme" parent="android:Theme.Light"> | ||
<!-- | ||
Theme customizations available in newer API levels can go in | ||
res/values-vXX/styles.xml, while customizations related to | ||
backward-compatibility can go here. | ||
--> | ||
</style> | ||
|
||
<!-- Application theme. --> | ||
<style name="AppTheme" parent="AppBaseTheme"> | ||
<!-- All customizations that are NOT specific to a particular API-level can go here. --> | ||
</style> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters