Output control
Output control functionality allows operators to apply usage rules for premium content to comply with their contracts with studios. Depending on the device and the technology, the rules can vary. The SDK receives usage rule metadata that is extracted from the licence and enforces the rule as required.
There are a number of output control licence usage rules that can be set on content to affect how that content is displayed on external devices or when being played on a compromised device. The following sections describe the different use cases.
The OutputControlListener
interface defines how the SDK exposes notifications of events related to output control.
Access status is reflected in the values obtained from the OutputControlListener
interface's onAccessStateChanged
signal, or from calling OutputController.getOutputController().getAccessState()
, which returns one of the following values:
Device Type | Enumeration |
---|---|
ACCESS_STATE_NO_LIMITATION | 0 |
ACCESS_STATE_BITRATE_LIMIT | 1 |
ACCESS_STATE_RESOLUTION_LIMIT | 2 |
ACCESS_STATE_RESTRICTIVE | 3 |
ACCESS_STATE_BLOCKED | 4 |
Example code
- For blocked content, the application may have to indicate to the user that this condition has been met.
- For restricted content, the application should blank the connected external display.
The following example code covers both of these scenarios:
private final static class BlankPresentation extends Presentation {
private GLSurfaceView mSurfaceView;
public BlankPresentation(Context context, Display display) {
super(context, display);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// Be sure to call the super class.
super.onCreate(savedInstanceState);
Resources r = getContext().getResources();
// Inflate the layout.
setContentView(R.layout.about_view);
}
}
...
private OutputControlListener mOutputControlListener = new OutputControlListener() {
@Override
public void onDeviceConnected(int i) {
NMPLog.d(TAG, "OutputControlListener::onDeviceConnected");
mDeviceConnected = i;
}
@Override
public void onDeviceDisconnected(int i) {
NMPLog.d(TAG, "OutputControlListener::onDeviceDisconnected");
if(mDeviceConnected == i){
mDeviceConnected = OutputController.OUTPUT_DEVICE_LOCAL;
}
}
...
public void onAccessStateChanged(int i) {
NMPLog.d(TAG, "OutputControlListener::onAccessStateChanged,state: " + OutputController.getOutputController().getAccessState());
if(i == OutputController.ACCESS_STATE_BLOCKED) {
PlaybackActivity pa = (PlaybackActivity) getActivity();
pa.onInfo("Output Control Limitation", "Playback Blocked : Disconnect "+mConnectedDeviceName[mDeviceConnected]);
} else if (i == OutputController.ACCESS_STATE_RESTRICTIVE) {
MediaRouter mediaRouter = (MediaRouter) mContext.getSystemService(Context.MEDIA_ROUTER_SERVICE);
MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute(0);
if (route != null) {
Display presentationDisplay = route.getPresentationDisplay();
if (presentationDisplay != null) {
Presentation presentation = new BlankPresentation(mContext, presentationDisplay);
presentation.show();
}
}
}
}
Compromised devices
Usage rules enforce access to content on compromised devices in the following ways:
- No control
Where a user selects content where the licence usage rule does not block, the content can be played. - Blocked
The user selects content where the licence usage rule requires blocking. The licence is not granted and playback does not start. - Bitrate capped
The user selects content where the licence usage rule requires bitrate capping. Here, the content can be played at or below the bitrate cap. - Resoution capped
The user selects content where the licence usage rule requires resolution capping. The content can be played at or below the resolution cap.
Mirroring (casting)
When mirroring (casting) is used, usage rules are applied as follows. This is explained in more detail below.
Usage rule | Already mirroring when content selected | Mirroring started after content selected | Mirroring disconnected |
---|---|---|---|
Blocking | Playback does not start on the device or mirror. | Playback is paused on device and mirror. | Already mirroring when content selected: Playback is paused on the device until play is pressed. Mirroring started after content was selected: Playback resumes on the device. |
No control | Playback starts on the device and mirror. | Playback continues on the device and mirror. | Playback continues on the device. |
Digital display
Devices can be considered secure (HDCP compliant) or non-secure (non-HDCP compliant). Usage rules enforce the access to content being displayed via digital output in the following ways:
- Blocked
- Bitrate capped
- Resolution capped
- Restricted
- No control
HDCP is enabled on the Android platform, so in most cases HDCP is always applied automatically. However, non-HDCP devices are also catered for. There are several variations in the digital display usage rules – these are separated into sub-sections for HDCP and non-HDCP, with each having a scenario for connecting before or after playback of content for each of the variations in the usage rule.
HDCP enabled device
Usage rule | Display already connected when content selected | Display connected after content selected | When display disconnected |
---|---|---|---|
Blocking | Playback does not start | Playback is paused | Playback resumes on device |
Bitrate capped | Playback starts on device only, no output to external display | Playback continues on device only, no output to external display | Playback continues on device only |
Resolution capped | Playback starts on device only, no output to external display | Playback continues on device only, no output to external display | Playback continues on device only |
Restricted | Playback starts unaffected | Playback continues unaffected | Playback continues unaffected |
No control | Playback starts unaffected | Playback continues unaffected | Playback continues unaffected |
Non-HDCP enabled device
Usage rule | Display already connected when content selected | Display connected after content selected | When display disconnected |
---|---|---|---|
Blocking | Playback does not start | Playback is paused | Playback resumes on device |
Bitrate capped | Playback forcibly adapted down to be within limit | Playback forcibly adapted down to be within limit | Limit is lifted |
Resolution capped | Playback forcibly adapted down to be within limit | Playback forcibly adapted down to be within limit | Limit is lifted |
Restricted | Playback starts on device only, no output to external display | Playback continues on device only, no output to external display | Playback continues on device only |
No control | Playback starts unaffected | Playback continues unaffected | Playback continues unaffected |