Package com.amazonaws.ivs.broadcast
Class Stage
java.lang.Object
com.amazonaws.ivs.broadcast.Stage
- All Implemented Interfaces:
Releasable
The main interface for the host application to create a Stage and interact with the created session.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
ConnectionState indicates current Stage session statestatic enum
The various potential publish states for a participantstatic interface
The Strategy is the decision engine associated with a Stage.static enum
The various potential subscribe states for a participantstatic enum
SubscribeType is used inStage.Strategy
to indicate whether SDK should subscribe and what media type it should subscribe -
Constructor Summary
ConstructorDescriptionStage
(android.content.Context context, String token, Stage.Strategy strategy) Create a new Stage. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRenderer
(StageRenderer renderer) Adds a renderer to the list of renderers that will be notified of updates to the Stage.protected void
finalize()
void
join()
Joins the Stage session associated with the token provided during initialization.void
leave()
Leaves the joined Stage session.void
Triggers theStage.Strategy
on this instance to refresh its state.void
release()
Releases the resources associated with this Stage.void
removeRenderer
(StageRenderer renderer) Removes a renderer from the list of renderers that will be notified of updates to the Stage.void
replaceStrategy
(Stage.Strategy strategy) Whenever strategy is changed and host application wants SDK to honor the change, this method needs to be called.
-
Constructor Details
-
Stage
public Stage(@NonNull android.content.Context context, @NonNull String token, @NonNull Stage.Strategy strategy) Create a new Stage. This is the main interaction point for interacting with the Stage SDK.- Parameters:
context
- A DisplayContext or ActivityContext. The ApplicationContext may cause issues for applications compiled against newer SDK versions.token
- A token generated by the IVS control plane that will be used to join the Stage whenjoin()
is called.strategy
- TheStage.Strategy
to use for this Stage.
-
-
Method Details
-
finalize
-
join
Joins the Stage session associated with the token provided during initialization.- Throws:
BroadcastException
- if this Stage has already calledrelease()
, or if the token provided in Stage constructor was invalid or expired.
-
leave
public void leave()Leaves the joined Stage session. If no Stage session is joined, this call is a no-op -
addRenderer
Adds a renderer to the list of renderers that will be notified of updates to the Stage.- Parameters:
renderer
- renderer delegate implementation
-
removeRenderer
Removes a renderer from the list of renderers that will be notified of updates to the Stage.- Parameters:
renderer
- renderer delegate implementation
-
replaceStrategy
Whenever strategy is changed and host application wants SDK to honor the change, this method needs to be called.- Parameters:
strategy
- strategy delegate implementation
-
refreshStrategy
public void refreshStrategy()Triggers theStage.Strategy
on this instance to refresh its state. This is how host applications will make changes to how they are interacting with a Stage. -
release
public void release()Releases the resources associated with this Stage. After calling this, the Stage will no longer be useable.- Specified by:
release
in interfaceReleasable
-