Playback of clear content
To test this feature and view the example code, please see the Android SDK 4 Example Code Quick Start guide.
The client application controls the lifecycle of the player. The player is created and initialised when the client application starts up using thr following code within the application entry point activity onCreate() method.
NMPSDK.load(getApplicationContext());
To enable users to watch clear content, an NMPVideoView
object has to be created and configured.
Additional steps are required to watch protected content, see NAGRA PRM Protected playback.
If the streaming content is being served over HTTPS, you may need to disable SSL verification under certain circumstances. See Disabling SSL verification.
Example code
The following code shows how to enable users to watch clear content:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//It is necessary to load sdk library first before using the sdk
NMPSDK.load(this.getApplicationContext());
setContentView(R.layout.content_main);
mNMPVideoView = findViewById(R.id.nmpVideoView);
mNMPVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mNMPVideoView.start();
}
});
}