Implementing Custom Controls for Android

Learn how to configure the player with custom controls for Android playback.

Ooyala's Android SDK provides tools for overriding the default fullscreen and inline controls. The following steps explain how to run custom controls over the OoyalaPlayer.

Note: If you use the OptimizedOoyalaPlayerLayoutController you only need to override the Inline controls. For more information see the Ooyala Mobile SDK for Android API documentation.
  1. The Ooyala Mobile SDK folder includes a directory named Default Controls. Copy the following files from this folder to the project source folder:
    • Images.java
    • OptimizedOoyalaPlayerLayoutController
    • DefaultOoyalaPlayerInlineControls.java
  2. Rename the following control files to create your code base for custom fullscreen and inline controls.
    • OptimizedOoyalaPlayerLayoutController.java (e.g. MyLayoutController.java)
    • DefaultOoyalaPlayerInlineControls.java MyInlineControls.java)
  3. Edit the base code to create your custom inline and fullscreen controls.
    Note:

    For more information about implementing custom controls see the Ooyala Mobile SDK for iOS API documentation. You can see an example of custom controls with our sample app repository:

    Ooyala AdvancedPlaybackSampleApp

  4. Instantiate an OoyalaPlayerLayout in the project activity code and add the new custom control files. This step is shown in the following example code:
     OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer);
        MyLayoutController playerLayoutController = new MyLayoutController(
            playerLayout, PCODE, new PlayerDomain(DOMAIN));
        player = playerLayoutController.getPlayer();
        MyInlineControls ic = new MyInlineControls(player, playerLayout);
        playerLayoutController.setInlineControls(ic);

    Your custom controls will now be used in the Ooyala Player. You can confirm this by adding/removing views from your custom controls or by adding logging.

해당 내용이 도움 되었습니까?