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
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!
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
import tv.nexx.android.play.player.Player;
5
6
public class PlayerActivity{
7
8
private INexxPLAY player;
9
10
@Override
11
public void onCreate(Bundle savedInstanceState) {
12
...
13
ViewGroup root = (ViewGroup) findViewById(R.id.root);
14
15
//define the Player object
16
NexxPLAY player = new NexxPLAY(this, root, getWindow());
17
18
//define an Environment and specify at least the DomainID
19
NexxPLAYEnvironment env = new NexxPLAYEnvironment(new HashMap<String, Object>() {{
20
put(domain, ":domainid");
21
...
22
}});
23
player.setEnvironment(env);
24
25
//define a Configuration and specify all Overrides, that shall be applied
26
NexxPLAYConfiguration config = new NexxPLAYConfiguration(new HashMap<String, Object>() {{
27
...
28
}});
29
30
//start Playback of a given Media (here, by Streamtype and ID)
31
player.startPlay(":streamtype", ":mediaid", config);
32
}
33
34
@Override
35
public void onResume() {
36
super.onResume();
37
player.onActivityResume();
38
}
39
40
@Override
41
public void onPause() {
42
super.onPause();
43
player.onActivityPause();
44
}
45
46
@Override
47
public void onDestroy() {
48
super.onDestroy();
49
player.onActivityDestroyed();
50
}
51
}
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)
sessionID
String
the ID of the current Session
language
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 for this Player (for Reporting)
useSSL
Bool
set to false if the Player should not use SSL (default is false)
trackingOptOuted
Bool
if the App user explicitley opts out of Tracking and this Information is relevant for Ads, set this to true
consentString
String
in TCF/CMP Envrionments, the Player might need the User Consent String for Ad Calls
alwaysInFullscreen
Bool
initially and always show the Player in Fullscreen (default is false)
showCloseButtonOnFullscreen
Bool
set to false, if the Fullscreen should not show a "close" Button (default is true)

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.player.Player;
5
6
public class PlayerActivity implements NexxPLAYNotification.Listener {
7
8
private INexxPLAY player;
9
10
@Override
11
public void onCreate(Bundle savedInstanceState) {
12
...
13
}
14
15
@Override
16
public void onResume() {
17
super.onResume();
18
player.addPlaystateListener(this);
19
player.onActivityResume();
20
}
21
22
@Override
23
public void onPause() {
24
super.onPause();
25
player.removePlaystateListener(this);
26
player.onActivityPause();
27
}
28
29
@Override
30
public void onDestroy() {
31
super.onDestroy();
32
player.onActivityDestroyed();
33
}
34
}
35
@Override
36
public void onPlayerEvent(NexxPLAYNotification.IPlayerEvent playerEvent) {
37
//do something with the Event
38
}
39
40
@Override
41
public void onPlayerStateChanged(boolean playWhenReady, Player.State current) {
42
//do something
43
}
44
45
@Override
46
public void onPlayerError(String reason, String details) {
47
//do something
48
}
49
50
@Override
51
public void onFullScreen(boolean fullScreen) {
52
//do something
53
}
54
55
}
Copied!

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.
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, float 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, float 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 provider, float delay = 0, String reason:String = "", boolean showReturnButton = false)
Copied!

Requesting Player Status and Details

1
//returns Information about the currently played Media Item
2
getMediaData() -> [String:Any]
Copied!
1
//returns the Captions of the current Media Item
2
getCaptionData(String language): String[]
Copied!
1
//returns all available Caption Languages of the current Media
2
getCaptionLanguages(): String[]
Copied!
1
//returns all available Audio Languages of the current Media
2
getAudioLanguages(): String[]
Copied!
1
//returns the current playback time of the Player
2
getCurrentTime(): float
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!

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.player.Player;
5
6
public class PlayerActivity implements NexxPLAYNotification.Listener {
7
8
private INexxPLAY player;
9
10
...
11
12
13
@Override
14
public boolean dispatchKeyEvent(KeyEvent event) {
15
if (player.dispatchKeyEvent(event)) {
16
return true;
17
} else {
18
return super.dispatchKeyEvent(event);
19
}
20
}
21
}
Copied!

Picture-in-Picture

To enable Picture-in-Picture 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.player.Player;
5
6
public class PlayerActivity implements NexxPLAYNotification.Listener {
7
8
private INexxPLAY player;
9
10
...
11
12
13
14
@Override
15
public void onUserLeaveHint() {
16
player.onUserLeaveHint();
17
}
18
19
@Override
20
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
21
NexxPLAY player = NexxPlayProvider.getInstance();
22
if (player != null) {
23
player.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
24
}
25
}
26
}
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.

Notch Support

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.
Last modified 13d ago