nexxPLAY
Search…
nexxPLAY for Android
nexxPLAY for android is a native Player, that is intended to work in native android Apps
In this Section, you will find all necessary basic Steps to integrate the nexxPLAY SDK to your native android App.
Please notice - 3Q nexx also provides a sample App, that you can find here:
GitHub - 3qnexx/nexxPLAY-android: nexxPLAY SDK for android
GitHub

General Integration

First add the 3Q nexx Repository to the Apps allprojects Gradle Definition.
1
...
2
maven { url "https://www.myget.org/F/3qnexx/maven" }
3
...
Copied!
Add the Dependency for nexxPLAY in the Apps build.gradle:
1
dependencies {
2
...
3
implementation 'tv.nexx.android:play:6.+'
4
...
5
}
Copied!
Make sure, that every Activity, that uses nexxPLAY handles configChanges:
1
<application>
2
...
3
<activity
4
...
5
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout" />
6
7
</application>
Copied!
nexxPLAY needs a root anchor view which should be a FrameLayout. Please add something likes this to your layout, depending on your needs:
1
<FrameLayout
2
android:id="@+id/root"
3
android:layout_width="match_parent"
4
android:layout_height="match_parent" />
Copied!

Adding a Player Instance

nexxPLAY needs a single view. The root view is the view group where the media player control layout (the player skin) is shown. Also the player needs the Acitivity's window
1
import tv.nexx.android.play.NexxPLAY;
2
import tv.nexx.android.play.NexxPLAYConfiguration;
3
import tv.nexx.android.play.NexxPLAYEnvironment;
4
5
public class PlayerActivity{
6
7
private NexxPLAY player;
8
9
@Override
10
public void onCreate(Bundle savedInstanceState) {
11
...
12
ViewGroup root = (ViewGroup) findViewById(R.id.root);
13
14
//define the Player object
15
NexxPLAY player = new NexxPLAY(this, root, getWindow());
16
17
//define an Environment and specify at least the DomainID
18
NexxPLAYEnvironment env = new NexxPLAYEnvironment(new HashMap<String, Object>() {{
19
put(domain, ":domainid");
20
...
21
}});
22
player.setEnvironment(env);
23
24
//define a Configuration and specify all Overrides, that shall be applied
25
NexxPLAYConfiguration config = new NexxPLAYConfiguration(new HashMap<String, Object>() {{
26
...
27
}});
28
29
//start Playback of a given Media (here, by Streamtype and ID)
30
player.startPlay(":streamtype", ":mediaid", config);
31
}
32
33
@Override
34
public void onResume() {
35
super.onResume();
36
player.onActivityResume();
37
}
38
39
@Override
40
public void onPause() {
41
super.onPause();
42
player.onActivityPause();
43
}
44
45
@Override
46
public void onDestroy() {
47
super.onDestroy();
48
player.onActivityDestroyed();
49
}
50
}
Copied!
You can also use the NexxPlayProvider Singleton, if you prefer a synchronized Singleton Approach:
1
@Override
2
public void onCreate(Bundle savedInstanceState) {
3
...
4
NexxPLAY player = NexxPlayProvider.init(getContext(), root, getActivity().getWindow());
5
...
6
}
Copied!

Player Environment

The NexxPLAYEnvironment object contains global settings for the player object. Except for the domain all the settings are optional and have a predefined value. The settings are:
Attribute
Type
Value
domain
String
the ID of the domain (mandatory)
contentURITemplate
String
a Template to build a valid URL for an App Intent
contentIDTemplate
String
a Template to build a valid ContentID of each Media
sessionID
String
the ID of the current Session
language
String (2-Letter-Code)
the Player Langage, will be computed by the System Language and Domain Settings if omitted
userHash
String
an Identifer of the currently loggedin User
externalUserReference
String
an Identifier of a User, that is not registered by nexxOMNIA
affiliatePartner
Int
the ID of an existing Affiliate Partner of the calling Domain
deliveryPartner
Int
the ID of an existing DeliveryPartner of the calling Domain
contextReference
String
the Context Reference for this Player (an indication of "where this Player is located" for Reporting)
useSSL
[0,1]
set to 0 if the Player should not use SSL (default is 1)
trackingOptOuted
[0,1]
if the App user explicitley opts out of Tracking and this Information is relevant for Ads, set this to 1
consentString
String
in TCF/CMP Envrionments, the Player might need the User Consent String for Ad Calls
alwaysInFullscreen
[0,1]
initially and always show the Player in Fullscreen (default is 0)
showCloseButtonOnFullscreen
[0,1]
set to 0, if the Fullscreen should not show a "close" Button (default is 1)
castContext
CastContext
compare Chromecast Support Docs for this Parameter.

Player Configuration

Just like the Javascript Player, the Player can be configured by a Configuration Object. This Object will be used in one of the various play() Methods of the SDK.
All Options are identical to the general SDK Override Options, you will find here:
Please notice, that some Options only make sense in the Web and are therefore not supported.
If you are looking for the TCF Consent String Management, this is documented here:

Public Methods

Preparing and Configuring the Player

1
//Sets the environment object for the player. This method must be called before any start method is called
2
setEnvironment(NexxPLAYEnvironment nexxPLAYEnvironment)
Copied!
1
//update a previously defined Environment Value
2
//domain, language, sessionID and alwaysInFullscreen cannot be updated
3
updateEnvironment(String key, String value)
Copied!
1
//start the Player with the given Media
2
startPlay(String streamtype, String mediaID, NexxPLAYConfiguration configuration)
Copied!
1
//start the Player with a given GlobalID
2
startPlayWithGlobalID(String globalID, NexxPLAYConfiguration configuration)
Copied!
1
//start the Player with a Remote Media Reference
2
startPlayWithRemoteMedia(String streamtype, String reference, String provider, NexxPLAYConfiguration configuration)
Copied!
1
//update a previously defined Configuration.
2
//supported are currently only the ad*URL Configuration Settings (and webURLRepresentation).
3
updateConfiguration(String key, String value)
Copied!
1
//will clear all currently cached Data
2
clearCache()
Copied!

Playback Control

1
//restart a paused Player
2
play()
Copied!
1
//pauses a playing Player
2
pause()
Copied!
1
//pauses/restarts a Player, depending on its current State
2
toggle()
Copied!
1
//mutes the Player
2
mute()
Copied!
1
//unmutes the Player
2
unmute()
Copied!
1
//seeks to the given Time, if the Media supports that
2
seekTo(Float time)
Copied!
1
//seeks relatively by a certain amount of Seconds, if the Media supports that
2
seekBy(Float seconds)
Copied!
1
//swap to the next Item in a Container Element
2
next()
Copied!
1
//swap to the previous Item in a Container Element
2
previous()
Copied!
1
//swap to a new Item in a Container Element
2
swapToPosition(int position)
Copied!
1
//swap to a completely new Media Item
2
swapToMediaItem(String mediaID, String streamtype:String, int startPosition = 0, Double delay = 0, String reason = "", Boolean showReturnButton = false)
Copied!
1
//swap to a completely new Media Item, referenced by a GlobalID
2
swapToGlobalID(String globalID, int startPosition = 0, Double delay = 0, String reason = "", Boolean showReturnButton = false)
Copied!
1
//swap to a completely new Media Item, referenced by a Remote Reference
2
swapToRemoteMedia(String reference, String streamtype, String provider, Double delay = 0, String reason:String = "", Boolean showReturnButton = false)
Copied!

Requesting Player Status and Details

1
//returns Information about the currently played Media Item
2
getCurrentMedia(): tv.nexx.play.android.MediaData
Copied!
1
//returns Information about the Container Element of the currently played Media Item
2
getCurrentMediaParent(): tv.nexx.play.android.MediaParentData
Copied!
1
//returns Information about the current Playback State of the Player
2
getCurrentPlaybackState(): tv.nexx.play.android.PlaybackState
Copied!
1
//returns the Captions of the current Media Item (or only the ones matching the given Language)
2
getCaptions(@Nullable String language): tv.nexx.play.android.Caption[]
Copied!
1
//returns all available Audio Tracks of the current Media
2
getAudioTracks(): tv.nexx.play.android.AudioTrack[]
Copied!
1
//returns the current playback time of the Player
2
getCurrentTime(): Float
Copied!
1
//returns the Files, connected to the current Media
2
getConnectedFiles(): tv.nexx.play.android.ConnectedFile[]
Copied!
1
//returns true, if the Player is currently playing
2
isPlaying(): Boolean
Copied!
1
//returns true, if the Player is currently playing an Ad
2
isPlayingAd(): Boolean
Copied!
1
//returns true, if the Player is currently muted
2
isMuted(): Boolean
Copied!
1
//returns true, if the Player is currently in PictureToPicture Mode
2
isInPiP(): Boolean
Copied!
1
turns true, if the Player is currently casting
2
isCasting(): Boolean
Copied!

LocalMedia and Offline Playback

nexxPLAY for android also supports Playback of previously downloaded Media Items and therefore offers some SDK Methods to manage localMedia.
1
//start a Download of a given Media Item (internal ID or Remote Reference)
2
startDownloadLocalMedia(String mediaID, String streamtype, @Nullable String provider)
Copied!
1
//returns a List of currently available localMedia Items
2
listLocalMedia(@Nullable String streamtype)
Copied!
1
//returns true, if the referenced Media Item is already available locally
2
hasDownloadOfLocalMedia(String mediaID, String streamtype, @Nullable String provider): Boolean
Copied!
1
//remove a previously downloaded Media Item
2
removeLocalMedia(String mediaID:String, String streamtype, @Nullable String provider:String)
Copied!
1
//remove all previously downloaded Media Items
2
clearLocalMedia(@Nullable String streamtype)
Copied!
1
//returns the currently used Storage by downloaded Media Items
2
diskSpaceUsedForLocalMedia():long
Copied!
This Feature must be enabled within nexxOMNA. Furthermore, various Settings to finetune the Details of the localMedia Behaviour can be setup there. Contact 3Q nexx for more Information.

Player Notifications

Just like the Javascript Player, the Player emits all Events to a Listener Function, that can be configured as outlined below. The Player Class has to implement the NexxPLAYNotification.Listener Interface in this case.
1
import tv.nexx.android.play.NexxPLAYConfiguration;
2
import tv.nexx.android.play.NexxPLAYEnvironment;
3
import tv.nexx.android.play.NexxPLAYNotification;
4
import tv.nexx.android.play.INexxPLAY;
5
import tv.nexx.android.play.player.IPlayer;
6
7
public class PlayerActivity implements NexxPLAYNotification.Listener {
8
9
private INexxPLAY player;
10
11
@Override
12
public void onCreate(Bundle savedInstanceState) {
13
...
14
}
15
16
@Override
17
public void onResume() {
18
super.onResume();
19
player.addPlaystateListener(this);
20
player.onActivityResume();
21
}
22
23
@Override
24
public void onPause() {
25
super.onPause();
26
player.removePlaystateListener(this);
27
player.onActivityPause();
28
}
29
30
@Override
31
public void onDestroy() {
32
super.onDestroy();
33
player.onActivityDestroyed();
34
}
35
}
36
@Override
37
public void onPlayerEvent(NexxPLAYNotification.IPlayerEvent playerEvent) {
38
//do something with the Event
39
}
40
41
@Override
42
public void onPlayerStateChanged(boolean playWhenReady, IPlayer.State state) {
43
//do something
44
}
45
46
@Override
47
public void onPlayerError(String reason, String details) {
48
//do something
49
}
50
51
@Override
52
public void onFullScreen(boolean fullScreen) {
53
//do something
54
}
55
56
}
Copied!

Additional Information

TV Support

To send events from the remote control to the player, add the following code:
1
import tv.nexx.android.play.NexxPLAYConfiguration;
2
import tv.nexx.android.play.NexxPLAYEnvironment;
3
import tv.nexx.android.play.NexxPLAYNotification;
4
import tv.nexx.android.play.NexxPLAY;
5
6
public class PlayerActivity implements NexxPLAYNotification.Listener {
7
8
...
9
10
@Override
11
public boolean dispatchKeyEvent(KeyEvent event) {
12
NexxPLAY player = NexxPlayProvider.getInstance();
13
if (player != null && player.dispatchKeyEvent(event)) {
14
return true;
15
}
16
return super.dispatchKeyEvent(event);
17
}
18
}
Copied!
nexxPLAY for android TV also support the "WatchNext" System, if possible (GoogleTV needs a manual Review for this Feature).
In order to make this work, a valid contentURITemplate and contentIDTemplate must be set. This can be done either within nexxOMNIA or via the Environment Settings.
Please notice, that nexxOMNIA can also manage the Channel Rows on androidTV. You will fnd the Link to this Extension on the Bottom of this Page.

Picture-in-Picture

To enable Picture-in-Picture (on mobile, Tablet and/or TV) add the following code:
1
import tv.nexx.android.play.NexxPLAYConfiguration;
2
import tv.nexx.android.play.NexxPLAYEnvironment;
3
import tv.nexx.android.play.NexxPLAYNotification;
4
import tv.nexx.android.play.NexxPLAY;
5
6
public class PlayerActivity implements NexxPLAYNotification.Listener {
7
8
...
9
10
@Override
11
public void onUserLeaveHint() {
12
NexxPLAY player = NexxPlayProvider.getInstance();
13
if (player != null) {
14
player.onUserLeaveHint();
15
}
16
}
17
18
@Override
19
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
20
NexxPLAY player = NexxPlayProvider.getInstance();
21
if (player != null) {
22
player.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
23
}
24
}
25
}
Copied!
Picture-in-Picture must also be declared in the App Manifest, at least like this:
android:supportsPictureInPicture="true"
Picture-in-Picture also requires to be enabled in nexxOMNIA Player Settings and/or Configuration with Overrides.
Additionally, it may not be available on all Devices, depending on Hardware Capabilities.

Chromecast

nexxPLAY for android supports Chromecast and Casting on mobile and Tablet Devices.
Chromecast can only be used, if 3Q nexx adds this Module to the target Domain. If Chromecast Module is enabled, follow these Implementation Steps to enable Chromecast also in the android App.
First, add the Chromecast Receiver Application ID (from 3Q nexx) to your "res/values/strings.xml":
1
...
2
<string name="chromecast_receiver_app" translatable="false">RECEIVER_APP</string>
3
...
Copied!
Add the latest Cast Framework to the build.gradle of the App:
1
implementation 'com.google.android.gms:play-services-cast-framework:21.0.1'
Copied!
Add the nexxPLAY CastOptionsProvider Class as MetaData to the Manifest:
1
<application>
2
...
3
4
<meta-data
5
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
6
android:value="tv.nexx.android.play.cast.CastOptionsProvider"/>
7
8
</application>
Copied!
Within the main Application, as early as possible and in the "onCreate" Method, initiate the CastContext, provided by Google Play Services and save it. This CastContext should be used then every time, nexxPLAY is initiated.
1
public class MainActivity{
2
...
3
@Override
4
public void onCreate(Bundle savedInstanceState) {
5
super.onCreate(savedInstanceState);
6
7
try{
8
mCastContext = CastContext.getSharedInstance(this);
9
}catch(Exception e){
10
//on some Devices (and TV!), CastContext is not available
11
}
12
}
13
...
14
}
Copied!
Every time, the Application starts a new nexxPLAY Instance, set NexxPLAYEnvironment.castContext to the captured CastContext (mCastContext in this Example). The rest will be handled by nexxPLAY internally.

Notch and Display CutOut

nexxPLAY will automatically respect the App Notch Settings and expand under it, if defined. If this is desired, configure the App Theme like:
1
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation">true</item>
Copied!

Flutter

nexxPLAY for android is also supported in Flutter.

Widgets

The android Platform also supports native Widgets by nexxPLAY.