diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/AndroidManifest.xml b/brightcove-exoplayer/BumperSampleApp/src/main/AndroidManifest.xml new file mode 100644 index 00000000..850e60c7 --- /dev/null +++ b/brightcove-exoplayer/BumperSampleApp/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/java/com/brightcove/player/samples/exoplayer/bumper/MainActivity.java b/brightcove-exoplayer/BumperSampleApp/src/main/java/com/brightcove/player/samples/exoplayer/bumper/MainActivity.java new file mode 100644 index 00000000..518bc51a --- /dev/null +++ b/brightcove-exoplayer/BumperSampleApp/src/main/java/com/brightcove/player/samples/exoplayer/bumper/MainActivity.java @@ -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 customFields = + (Map) 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(); + } + }); + } +} diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-hdpi/ic_launcher.png b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 00000000..0201441b Binary files /dev/null and b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-mdpi/ic_launcher.png b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 00000000..26721fd4 Binary files /dev/null and b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/ic_launcher.png b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 00000000..e6c33269 Binary files /dev/null and b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/tv_banner.png b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/tv_banner.png new file mode 100644 index 00000000..87ddfdeb Binary files /dev/null and b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xhdpi/tv_banner.png differ diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xxhdpi/ic_launcher.png b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..0d412f56 Binary files /dev/null and b/brightcove-exoplayer/BumperSampleApp/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/layout/activity_main.xml b/brightcove-exoplayer/BumperSampleApp/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..cbacdcf3 --- /dev/null +++ b/brightcove-exoplayer/BumperSampleApp/src/main/res/layout/activity_main.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/values/strings.xml b/brightcove-exoplayer/BumperSampleApp/src/main/res/values/strings.xml new file mode 100644 index 00000000..77a590a1 --- /dev/null +++ b/brightcove-exoplayer/BumperSampleApp/src/main/res/values/strings.xml @@ -0,0 +1,18 @@ + + + + Bumper Sample App + + + 4800266849001 + + + BCpkADawqM3n0ImwKortQqSZCgJMcyVbb8lJVwt0z16UD0a_h8MpEYcHyKbM8CGOPxBRp0nfSVdfokXBrUu3Sso7Nujv3dnLo0JxC_lNXCl88O7NJ0PR0z2AprnJ_Lwnq7nTcy1GBUrQPr5e + + + 1715882712036765088 + + + 1752206670195252559 + + diff --git a/brightcove-exoplayer/BumperSampleApp/src/main/res/values/styles.xml b/brightcove-exoplayer/BumperSampleApp/src/main/res/values/styles.xml new file mode 100644 index 00000000..6ce89c7b --- /dev/null +++ b/brightcove-exoplayer/BumperSampleApp/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/settings.gradle b/settings.gradle index 22f3e77b..2e37c5bb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,6 +17,7 @@ include ':brightcove-exoplayer:VideoListAdRulesIMASampleApp' include ':brightcove-exoplayer:BasicIMAVASTSampleApp' include ':brightcove-exoplayer:ThumbnailScrubberSampleApp' include ':brightcove-exoplayer:AudioOnlySampleApp' +include ':brightcove-exoplayer:BumperSampleApp' include ':brightcove-exoplayer-kotlin:AudioOnlySampleApp'