All UPI events are defined in a single interface - IOTVUPIEventListener. The application must implement an instance of this interface and pass over the instance's reference to the UPI Player to receive the various events.
Passing the instance can be done in two different ways:
-
Using the
OTVUPIPlayerFactoryclass, create the player with the listener instance using the class's methodJavapublic static IOTVUPIPlayer createPlayer( @NonNull Context xContext, @NonNull OTVUPISource xSrc, @Nullable IOTVUPIEventListener xEventListener) -
Passing the listener to the already-created player
Javaplayer.setEventListener(xEventListener);
onError event
The onError event is probably the most important callback defined in the IOTVUPIEventListener interface. It is called when an error occurs to notify the listener of an error and its nature. The relevant method prototypes for error handling are listed here:
void onError(@NonNull OTVUPIError xError)
int OTVUPIError.getCode()
OTVUPIError.Details OTVUPIError.getDetails()
int OTVUPIError.Details.getWhat()
int OTVUPIError.Details.getExtra()
@NonNull String OTVUPIError.getMessage()
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
Number |
The unique error code |
|
details |
Object |
The error details |
|
Android SDK-specific errors |
||
|
what |
Number |
|
|
extra |
Number |
|
|
message |
String |
|
|
Error code |
Category |
Description |
|---|---|---|
|
1000 |
UNKNOWN |
Any unknown error |
|
1001-1999 |
SOURCE |
Errors in the source:
|
|
2001-2999 |
MEDIA |
Errors in parsing or processing audio or video or subtitle streams:
|
|
3001-3999 |
NETWORK |
Errors from the network stack:
|
|
4001-4999 |
OFFLINECONTENT |
Errors for offline playback:
|
|
5001-5999 |
DRM |
Errors related to DRM:
|
|
6001-6999 |
SSM |
Errors related to SSM:
|
|
7001-7999 |
PLAYER |
Miscellaneous errors from the player:
|
|
8001-8999 |
BROADCAST CHANNEL |
Errors in playing broadcast services:
|