See: Description
The THEOplayer Android SDK can be used for Android devices using Android 4.1+ (minSdkVersion 16).
The SDK has 2 dependencies: com.android.support:appcompat-v7 and com.google.code.gson:gson. In the section below, we explain how to add them.
Importing the THEOplayer Android SDK Library can be done following these steps:
Additionally, you can import the sources jar to be able to immediately see the API java source files with their documentation in Android Studio. Follow the following after successfully importing the library steps for that:
For making fullscreen possible your AndroidManifest should have the following added to the activity:
android:configChanges="orientation|screenSize"
In order to use THEOplayer in an Android app, you will need the THEOplayerView as the central component. This class can be loaded in a Layout and this will create a new player object for you to interact with.
Important: In order to react to the activity stringRepresentation, users need to call the onResume, onPause and onDestroy when the matching methods are called in the activity using the THEOplayerView. Note that when using an AppCompatActivity, onResume() should be called by onPostResume().
When using XML to set your layout, you can add the following code to your XML file:
<com.theoplayer.android.api.THEOplayerView android:id="@+id/theoplayer_view" android:layout_width="match_parent" android:layout_height="match_parent" app:chromeless="true" app:cssPaths="style.css" app:jsPaths="script.js" />
It is possible to pass multiple css paths by separating them with a comma, but this also means that a single path is not allowed to contain a comma. URLs for remote files are possible too. Similarly , jsFiles can be passed by setting the app:jsPaths property.
Once you have the THEOplayerView in your layout, you can get a reference to it by using the findViewById-method.
Next to using XML to configure your view, you can also instantiate the view programmatically in Java. This can be done in the following way:
THEOplayerView view = new THEOplayerView(activity, config);
This view can then be placed inside another view and positioned in your layout.