Package com.castlabs.android.player

## Class CLLibraryLoader

- java.lang.Object
- - com.castlabs.android.player.CLLibraryLoader

-     public class CLLibraryLoader
      extends Object

  The library loader class is a class that provides static methods to register native libraries that will be loaded on request.

  The class will load `gnustl_shared` first, then the registered libraries in order of registration and the the castLabs player libraries.

  In addition to library names, you can also register `CLLibraryLoader.PostLoadAction` instances. Registered implementations of this interface will be executed once after libraries are loaded.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `CLLibraryLoader.PostLoadAction` | Register instances of this interface to call custom code triggered after all native libraries are loaded.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static boolean` | `ENABLED` | The library loader can be disabled.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `load()` | Call this method to load the registered native libraries and execute the post load actions.
    `static void` | `register​(CLLibraryLoader.PostLoadAction postLoadAction)` | Register a new post load action that will be executed by the loader after the native libraries are loaded.
    `static void` | `register​(String name)` | Register a library that needs to be loaded.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ENABLED

          public static boolean ENABLED

      The library loader can be disabled. This is useful for unit tests where the native libraries can not be loaded

  - ### Method Detail

    - #### register

          public static void register​(@NonNull
                                      String name)

      Register a library that needs to be loaded. NOTE that the name is the base name of the library without the "lib" prefix and without the ".so" suffix! For example, say you want to load libgnustl_shared.so that is distributed with your app. In this case you need to register "gnustl_shared" with this method
      Parameters:
        `name` - the library base name, i.e. "gnustl_shared"

    - #### register

          public static void register​(@NonNull
                                      CLLibraryLoader.PostLoadAction postLoadAction)

      Register a new post load action that will be executed by the loader after the native libraries are loaded.
      Parameters:
        `postLoadAction` - the post load action
      Throws:
        `IllegalStateException` - in case the libraries are already loaded

    - #### load

          public static void load()

      Call this method to load the registered native libraries and execute the post load actions.

      *NOTE* that you usually do *NOT* need to call this method explicitly. The framework will take care of library loading for you.