public class LiveEventListener extends Object
initWithLiveId(Identity, EventListener)
to get the instance. Call start(String)
to start observing changes and stop()
to stop observing.
You could observe the properties change like getBroadcastStateV2()
,
getBroadcastStartTimeInMS()
, getCCU()
, and getHitCount()
.Modifier and Type | Class and Description |
---|---|
static interface |
LiveEventListener.EventListener
The listener to listen events sent by
LiveEventListener . |
static interface |
LiveEventListener.State
|
Modifier and Type | Field and Description |
---|---|
static int |
BROADCAST_STATE_DVR_PLAYBACK_AVAILABLE
Means the live event state is still available for playback within amount of time temporarily
when this event is not broadcasting for live dvr enabled live event.
|
static int |
BROADCAST_STATE_ENDED
Means the live event state is ended.
|
static int |
BROADCAST_STATE_STARTED
Means the live event is broadcasting.
|
static int |
BROADCAST_STATE_STOPPED
Means the live event is not broadcasting and state is not ended.
|
static int |
BROADCAST_STATE_UNKNOWN
The initial value before fetching any information about the live event.
|
static int |
BROADCAST_STATE_WAITING_FOR_STREAM
Means the live event is waiting for stream.
|
static int |
STATE_IDLE
Means the
LiveEventListener is idle. |
static int |
STATE_STARTED
Means the
LiveEventListener has started. |
static int |
STATE_STARTING
Means the
LiveEventListener is starting. |
Modifier and Type | Method and Description |
---|---|
androidx.lifecycle.LiveData<Long> |
getBroadcastStartTimeInMS()
Gets the broadcast start time of the live event.
|
androidx.lifecycle.LiveData<Integer> |
getBroadcastStateV2()
Gets the broadcastStateV2.
|
androidx.lifecycle.LiveData<Integer> |
getCCU()
Gets the CCU of the live event.
|
androidx.lifecycle.LiveData<Integer> |
getHitCount()
Gets the hit count of the live event.
|
String |
getLiveId()
Gets the id of current listening live event.
|
int |
getState()
Gets the state of
LiveEventListener . |
static com.google.android.gms.tasks.Task<LiveEventListener> |
initWithLiveId(Identity identity,
LiveEventListener.EventListener listener)
Constructs a
LiveEventListener if you are a authorized developer. |
com.google.android.gms.tasks.Task<Void> |
start(String liveId)
Starts to listen the change of the live event related properties.
|
void |
stop()
Stops listening the live event related properties change.
|
public static final int STATE_IDLE
LiveEventListener
is idle. In this state, you could call start(String)
to listen live event state.getState()
,
Constant Field Valuespublic static final int STATE_STARTING
LiveEventListener
is starting. In this state, you could wait for the result
of start(String)
or call stop()
to stop it.getState()
,
Constant Field Valuespublic static final int STATE_STARTED
LiveEventListener
has started. In this state, you could observe values
change or call stop()
if you don't want to observe anymore.getState()
,
Constant Field Valuespublic static final int BROADCAST_STATE_UNKNOWN
public static final int BROADCAST_STATE_STARTED
public static final int BROADCAST_STATE_STOPPED
public static final int BROADCAST_STATE_WAITING_FOR_STREAM
public static final int BROADCAST_STATE_ENDED
public static final int BROADCAST_STATE_DVR_PLAYBACK_AVAILABLE
public static com.google.android.gms.tasks.Task<LiveEventListener> initWithLiveId(Identity identity, LiveEventListener.EventListener listener)
LiveEventListener
if you are a authorized developer.identity
- The user who fetches the live event information.listener
- The listener to listen events sent from LiveEventListener
.public com.google.android.gms.tasks.Task<Void> start(String liveId)
STATE_IDLE
.liveId
- the live event idpublic void stop()
public int getState()
LiveEventListener
.LiveEventListener
STATE_IDLE
,
STATE_STARTING
,
STATE_STARTED
public String getLiveId()
public androidx.lifecycle.LiveData<Integer> getBroadcastStateV2()
BROADCAST_STATE_UNKNOWN
,
BROADCAST_STATE_STARTED
, BROADCAST_STATE_STOPPED
,
BROADCAST_STATE_WAITING_FOR_STREAM
, BROADCAST_STATE_ENDED
or
BROADCAST_STATE_DVR_PLAYBACK_AVAILABLE
.LiveData
of broadcastStateV2BROADCAST_STATE_UNKNOWN
,
BROADCAST_STATE_STARTED
,
BROADCAST_STATE_STOPPED
,
BROADCAST_STATE_WAITING_FOR_STREAM
,
BROADCAST_STATE_ENDED
,
BROADCAST_STATE_DVR_PLAYBACK_AVAILABLE
public androidx.lifecycle.LiveData<Long> getBroadcastStartTimeInMS()
LiveData
of broadcast start timepublic androidx.lifecycle.LiveData<Integer> getCCU()
LiveData
of CCU