Added in API level 26

Session

class Session : AutoCloseable
kotlin.Any
   ↳ android.media.MediaCas.Session

Class for an open session with the CA system.

Summary

Public methods
Unit

Close the session.

Boolean
equals(other: Any?)

Query if an object equal current Session object.

ByteArray

Get Session Id.

Unit
processEcm(data: ByteArray, offset: Int, length: Int)

Send a received ECM packet to the specified session of the CA system.

Unit

Send a received ECM packet to the specified session of the CA system.

Unit
sendSessionEvent(event: Int, arg: Int, data: ByteArray?)

Send a session event to a CA system.

Unit

Set the private data for a session.

Public methods

close

Added in API level 26
fun close(): Unit

Close the session.

Exceptions
java.lang.Exception if this resource cannot be closed
java.lang.IllegalStateException if the MediaCas instance is not valid.
android.media.MediaCasStateException for CAS-specific state exceptions.

equals

Added in API level 26
fun equals(other: Any?): Boolean

Query if an object equal current Session object.

Parameters
obj an object to compare to current Session object.
Return
Boolean Whether input object equal current Session object.

getSessionId

Added in API level 30
fun getSessionId(): ByteArray

Get Session Id.

Return
ByteArray session Id of the session. This value cannot be null.
Exceptions
java.lang.IllegalStateException if the MediaCas instance is not valid.

processEcm

Added in API level 26
fun processEcm(
    data: ByteArray,
    offset: Int,
    length: Int
): Unit

Send a received ECM packet to the specified session of the CA system.

Parameters
data ByteArray: byte array of the ECM data. This value cannot be null.
offset Int: position within data where the ECM data begins.
length Int: length of the data (starting from offset).
Exceptions
java.lang.IllegalStateException if the MediaCas instance is not valid.
android.media.MediaCasException for CAS-specific errors.
android.media.MediaCasStateException for CAS-specific state exceptions.

processEcm

Added in API level 26
fun processEcm(data: ByteArray): Unit

Send a received ECM packet to the specified session of the CA system. This is similar to Session#processEcm(byte[], int, int) except that the entire byte array is sent.

Parameters
data ByteArray: byte array of the ECM data. This value cannot be null.
Exceptions
java.lang.IllegalStateException if the MediaCas instance is not valid.
android.media.MediaCasException for CAS-specific errors.
android.media.MediaCasStateException for CAS-specific state exceptions.

sendSessionEvent

Added in API level 29
fun sendSessionEvent(
    event: Int,
    arg: Int,
    data: ByteArray?
): Unit

Send a session event to a CA system. The format of the event is scheme-specific and is opaque to the framework.

Parameters
event Int: an integer denoting a scheme-specific event to be sent.
arg Int: a scheme-specific integer argument for the event.
data ByteArray?: a byte array containing scheme-specific data for the event. This value may be null.
Exceptions
java.lang.IllegalStateException if the MediaCas instance is not valid.
android.media.MediaCasException for CAS-specific errors.
android.media.MediaCasStateException for CAS-specific state exceptions.

setPrivateData

Added in API level 26
fun setPrivateData(data: ByteArray): Unit

Set the private data for a session.

Parameters
data ByteArray: byte array of the private data. This value cannot be null.
Exceptions
java.lang.IllegalStateException if the MediaCas instance is not valid.
android.media.MediaCasException for CAS-specific errors.
android.media.MediaCasStateException for CAS-specific state exceptions.