MbmsStreamingSession
public
class
MbmsStreamingSession
extends Object
implements
AutoCloseable
java.lang.Object | |
↳ | android.telephony.MbmsStreamingSession |
This class provides functionality for streaming media over MBMS.
Summary
Public methods | |
---|---|
void
|
close()
Terminates this instance. |
static
MbmsStreamingSession
|
create(Context context, Executor executor, int subscriptionId, MbmsStreamingSessionCallback callback)
Create a new |
static
MbmsStreamingSession
|
create(Context context, Executor executor, MbmsStreamingSessionCallback callback)
Create a new |
void
|
requestUpdateStreamingServices(List<String> serviceClassList)
An inspection API to retrieve the list of streaming media currently be advertised. |
StreamingService
|
startStreaming(StreamingServiceInfo serviceInfo, Executor executor, StreamingServiceCallback callback)
Starts streaming a requested service, reporting status to the indicated callback. |
Inherited methods | |
---|---|
Public methods
close
public void close ()
Terminates this instance. Also terminates
any streaming services spawned from this instance as if
StreamingService.close()
had been called on them. After this method returns,
no further callbacks originating from the middleware will be enqueued on the provided
instance of MbmsStreamingSessionCallback
, but callbacks that have already been
enqueued will still be delivered.
It is safe to call create(android.content.Context, java.util.concurrent.Executor, int, android.telephony.mbms.MbmsStreamingSessionCallback)
to
obtain another instance of MbmsStreamingSession
immediately after this method
returns.
May throw an IllegalStateException
create
public static MbmsStreamingSession create (Context context, Executor executor, int subscriptionId, MbmsStreamingSessionCallback callback)
Create a new MbmsStreamingSession
using the given subscription ID.
Note that this call will bind a remote service. You may not call this method on your app's
main thread.
You may only have one instance of MbmsStreamingSession
per UID. If you call this
method while there is an active instance of MbmsStreamingSession
in your process
(in other words, one that has not had close()
called on it), this method will
throw an IllegalStateException
. If you call this method in a different process
running under the same UID, an error will be indicated via
MbmsStreamingSessionCallback.onError(int, String)
.
Note that initialization may fail asynchronously. If you wish to try again after you
receive such an asynchronous error, you must call close()
on the instance of
MbmsStreamingSession
that you received before calling this method again.
Parameters | |
---|---|
context |
Context : The Context to use.
This value cannot be null . |
executor |
Executor : The executor on which you wish to execute callbacks.
This value cannot be null . |
subscriptionId |
int : The subscription ID to use. |
callback |
MbmsStreamingSessionCallback : A callback object on which you wish to receive results of asynchronous
operations.
This value cannot be null . |
Returns | |
---|---|
MbmsStreamingSession |
An instance of MbmsStreamingSession , or null if an error occurred. |
create
public static MbmsStreamingSession create (Context context, Executor executor, MbmsStreamingSessionCallback callback)
Create a new MbmsStreamingSession
using the system default data subscription ID.
See create(android.content.Context, java.util.concurrent.Executor, int, android.telephony.mbms.MbmsStreamingSessionCallback)
.
Parameters | |
---|---|
context |
Context : This value cannot be null . |
executor |
Executor : This value cannot be null . |
callback |
MbmsStreamingSessionCallback : This value cannot be null . |
Returns | |
---|---|
MbmsStreamingSession |
requestUpdateStreamingServices
public void requestUpdateStreamingServices (List<String> serviceClassList)
An inspection API to retrieve the list of streaming media currently be advertised.
The results are returned asynchronously via
MbmsStreamingSessionCallback.onStreamingServicesUpdated(List)
on the callback
provided upon creation.
Multiple calls replace the list of service classes of interest.
May throw an IllegalArgumentException
or an IllegalStateException
.
Parameters | |
---|---|
serviceClassList |
List : A list of streaming service classes that the app would like updates
on. The exact names of these classes should be negotiated with the
wireless carrier separately. |
startStreaming
public StreamingService startStreaming (StreamingServiceInfo serviceInfo, Executor executor, StreamingServiceCallback callback)
Starts streaming a requested service, reporting status to the indicated callback.
Returns an object used to control that stream. The stream may not be ready for consumption
immediately upon return from this method -- wait until the streaming state has been
reported via
StreamingServiceCallback.onStreamStateUpdated(int, int)
May throw an IllegalArgumentException
or an IllegalStateException
Asynchronous errors through the callback include any of the errors in
MbmsErrors.GeneralErrors
or
MbmsErrors.StreamingErrors
.
Parameters | |
---|---|
serviceInfo |
StreamingServiceInfo : The information about the service to stream. |
executor |
Executor : The executor on which you wish to execute callbacks for this stream.
This value cannot be null . |
callback |
StreamingServiceCallback : A callback that'll be called when something about the stream changes. |
Returns | |
---|---|
StreamingService |
An instance of StreamingService through which the stream can be controlled.
May be null if an error occurred. |