Skip navigation links

THEOplayer Android SDK

THEOplayer Android SDK Info

See: Description

Packages 
Package Description
com.theoplayer.android.api
THEOplayer SDK API package
com.theoplayer.android.api.abr  
com.theoplayer.android.api.ads  
com.theoplayer.android.api.cache  
com.theoplayer.android.api.cast  
com.theoplayer.android.api.cast.chromecast  
com.theoplayer.android.api.contentprotection  
com.theoplayer.android.api.event  
com.theoplayer.android.api.event.ads  
com.theoplayer.android.api.event.cache  
com.theoplayer.android.api.event.cache.task  
com.theoplayer.android.api.event.cache.tasklist  
com.theoplayer.android.api.event.chromecast  
com.theoplayer.android.api.event.player  
com.theoplayer.android.api.event.track  
com.theoplayer.android.api.event.track.mediatrack  
com.theoplayer.android.api.event.track.mediatrack.audio  
com.theoplayer.android.api.event.track.mediatrack.audio.list  
com.theoplayer.android.api.event.track.mediatrack.video  
com.theoplayer.android.api.event.track.mediatrack.video.list  
com.theoplayer.android.api.event.track.texttrack  
com.theoplayer.android.api.event.track.texttrack.list  
com.theoplayer.android.api.event.track.texttrack.texttrackcue  
com.theoplayer.android.api.event.track.tracklist  
com.theoplayer.android.api.event.verizonmedia  
com.theoplayer.android.api.event.vr  
com.theoplayer.android.api.event.yospace  
com.theoplayer.android.api.fullscreen  
com.theoplayer.android.api.message  
com.theoplayer.android.api.metrics  
com.theoplayer.android.api.player  
com.theoplayer.android.api.player.track  
com.theoplayer.android.api.player.track.mediatrack  
com.theoplayer.android.api.player.track.mediatrack.quality  
com.theoplayer.android.api.player.track.texttrack  
com.theoplayer.android.api.player.track.texttrack.cue  
com.theoplayer.android.api.settings  
com.theoplayer.android.api.source
THEOplayer SDK API source package
com.theoplayer.android.api.source.addescription  
com.theoplayer.android.api.source.analytics  
com.theoplayer.android.api.source.drm  
com.theoplayer.android.api.source.drm.preintegration  
com.theoplayer.android.api.source.metadata  
com.theoplayer.android.api.source.ssai  
com.theoplayer.android.api.source.ssai.dai  
com.theoplayer.android.api.source.ssai.yospace  
com.theoplayer.android.api.source.verizonmedia  
com.theoplayer.android.api.source.vr  
com.theoplayer.android.api.timerange  
com.theoplayer.android.api.ui  
com.theoplayer.android.api.util  
com.theoplayer.android.api.verizonmedia  
com.theoplayer.android.api.verizonmedia.ads  
com.theoplayer.android.api.verizonmedia.reponses  
com.theoplayer.android.api.verizonmedia.reponses.assetinfo  
com.theoplayer.android.api.vr  
com.theoplayer.android.api.yospace  

THEOplayer Android SDK Info

1. System Requirements

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.

2. Importing the library

Importing the THEOplayer Android SDK Library can be done following these steps:

  1. In your Android Studio, go to File > New Module > Import .JAR / .AAR Package.
  2. Navigate to the location where the theoplayer SDK aar file is stored and select it.
  3. Go to your project dependencies by going to File > Project Structure > dependencies tab.
  4. Add the module dependency by clicking the plus sign in the top-right corner and choose Module Dependency. Select the THEOplayer SDK aar file and click OK.
  5. Add the library dependencies (if they are not include yet) by clicking the plus sign in the top-right corner again and choosing library dependency. Then search for and add com.android.support:appcompat-v7 and com.google.code.gson:gson.

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:

  1. In the Projects Overview, set the view to the project view. You should now see "External Libraries"
  2. Under "External Libraries" you should be able to find the theoplayer-android SDK library, right click and select "Library Properties".
  3. In the top left corner of the Library Properties window, click the first green plus sign.
  4. Find and select the theoplayer-android SDK jar file and click ok.

For making fullscreen possible your AndroidManifest should have the following added to the activity:

android:configChanges="orientation|screenSize"

3. Using the THEOplayerView

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().

3.1. Setting up the THEOplayerView using XML

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.

3.2. Setting up the THEOplayerView Java

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.

Skip navigation links