Search in sources :

Example 1 with PlaylistListener

use of com.brightcove.player.media.PlaylistListener in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@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.ima_activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    mediaController = new BrightcoveMediaController(brightcoveVideoView);
    brightcoveVideoView.setMediaController(mediaController);
    super.onCreate(savedInstanceState);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    // Use a procedural abstraction to setup the Google IMA SDK via the plugin and establish
    // a playlist listener object for our sample video: the Potter Puppet show.
    setupGoogleIMA();
    // Remove the HLS_URL field from the catalog request to allow
    // midrolls to work.  Midrolls don't work with HLS due to
    // seeking bugs in the Android OS.
    Map<String, String> options = new HashMap<String, String>();
    List<String> values = new ArrayList<String>(Arrays.asList(VideoFields.DEFAULT_FIELDS));
    values.remove(VideoFields.HLS_URL);
    options.put("video_fields", StringUtil.join(values, ","));
    Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A..");
    catalog.findPlaylistByReferenceID("stitch", options, new PlaylistListener() {

        public void onPlaylist(Playlist playlist) {
            brightcoveVideoView.addAll(playlist.getVideos());
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Playlist(com.brightcove.player.model.Playlist) HashMap(java.util.HashMap) PlaylistListener(com.brightcove.player.media.PlaylistListener) ArrayList(java.util.ArrayList) Catalog(com.brightcove.player.media.Catalog) BrightcoveMediaController(com.brightcove.player.mediacontroller.BrightcoveMediaController)

Example 2 with PlaylistListener

use of com.brightcove.player.media.PlaylistListener in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@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.
    setContentView(R.layout.omniture_activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    setupOmniture();
    // Add a test video to the BrightcoveVideoView.
    Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A..");
    catalog.findPlaylistByReferenceID("stitch", new PlaylistListener() {

        public void onPlaylist(Playlist playlist) {
            brightcoveVideoView.addAll(playlist.getVideos());
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Playlist(com.brightcove.player.model.Playlist) PlaylistListener(com.brightcove.player.media.PlaylistListener) Catalog(com.brightcove.player.media.Catalog)

Example 3 with PlaylistListener

use of com.brightcove.player.media.PlaylistListener in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@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.
    setContentView(R.layout.freewheel_activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    adFrame = (FrameLayout) findViewById(R.id.ad_frame);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    setupFreeWheel();
    // Add a test video to the BrightcoveVideoView.
    Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A..");
    catalog.findPlaylistByReferenceID("stitch", new PlaylistListener() {

        public void onPlaylist(Playlist playlist) {
            brightcoveVideoView.addAll(playlist.getVideos());
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Playlist(com.brightcove.player.model.Playlist) PlaylistListener(com.brightcove.player.media.PlaylistListener) Catalog(com.brightcove.player.media.Catalog)

Example 4 with PlaylistListener

use of com.brightcove.player.media.PlaylistListener in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@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.
    setContentView(R.layout.adobepass_activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    super.onCreate(savedInstanceState);
    try {
        accessEnabler = AccessEnabler.Factory.getInstance(this);
        if (accessEnabler != null) {
            accessEnabler.setDelegate(this);
            accessEnabler.useHttps(true);
        }
    } catch (AccessEnablerException e) {
        Log.e(TAG, "Failed to initialize the AccessEnabler library: " + e.getMessage());
        return;
    }
    String requestorId = getResources().getString(R.string.requestor_id);
    String credentialStorePassword = getResources().getString(R.string.credential_store_password);
    InputStream credentialStore = getResources().openRawResource(R.raw.adobepass);
    // A signature must be passed along with the requestor id from a private key and a password.
    PrivateKey privateKey = extractPrivateKey(credentialStore, credentialStorePassword);
    String signedRequestorId = null;
    try {
        signedRequestorId = generateSignature(privateKey, requestorId);
    } catch (AccessEnablerException e) {
        Log.e(TAG, "Failed to generate signature.");
    }
    // The production URL is the default when no URL is passed. If
    // we are using a staging requestorID, we need to pass the staging
    // URL.
    ArrayList<String> spUrls = new ArrayList<String>();
    spUrls.add(STAGING_URL);
    // Set the requestor ID.
    accessEnabler.setRequestor(requestorId, signedRequestorId, spUrls);
    // TODO (once we media API changes are made):
    // Media API call will return result with nulled out URL fields if the media
    // is protected. We need to make the adobepass calls to get the token for the media,
    // then make another Media API call with the adobepass token included (in the header or
    // a cookie) which will return a result with non-nulled URL fields.
    // 1. Ignore URL fields on the first call.
    // 2. Make the AdobePass calls
    // 3. Add token to next Media API call.
    // Add a test video to the BrightcoveVideoView.
    Map<String, String> options = new HashMap<String, String>();
    List<String> values = new ArrayList<String>(Arrays.asList(VideoFields.DEFAULT_FIELDS));
    Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A..");
    catalog.findPlaylistByReferenceID("stitch", options, new PlaylistListener() {

        public void onPlaylist(Playlist playlist) {
            brightcoveVideoView.addAll(playlist.getVideos());
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Playlist(com.brightcove.player.model.Playlist) PrivateKey(java.security.PrivateKey) HashMap(java.util.HashMap) PlaylistListener(com.brightcove.player.media.PlaylistListener) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) AccessEnablerException(com.adobe.adobepass.accessenabler.api.AccessEnablerException) Catalog(com.brightcove.player.media.Catalog)

Aggregations

Catalog (com.brightcove.player.media.Catalog)4 PlaylistListener (com.brightcove.player.media.PlaylistListener)4 Playlist (com.brightcove.player.model.Playlist)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 AccessEnablerException (com.adobe.adobepass.accessenabler.api.AccessEnablerException)1 BrightcoveMediaController (com.brightcove.player.mediacontroller.BrightcoveMediaController)1 InputStream (java.io.InputStream)1 PrivateKey (java.security.PrivateKey)1