Package com.opentok
Class TokenOptions.Builder
- java.lang.Object
-
- com.opentok.TokenOptions.Builder
-
- Enclosing class:
- TokenOptions
public static class TokenOptions.Builder extends java.lang.Object
Use this class to create a TokenOptions object.- See Also:
TokenOptions
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenOptions
build()
Builds the TokenOptions object.TokenOptions.Builder
data(java.lang.String data)
A string containing connection metadata describing the end-user.TokenOptions.Builder
expireTime(long expireTime)
Sets the expiration time for the token.TokenOptions.Builder
initialLayoutClassList(java.util.List<java.lang.String> initialLayoutClassList)
A List of class names (strings) to be used as the initial layout classes for streams published by the client.TokenOptions.Builder
role(Role role)
Sets the role for the token.
-
-
-
Method Detail
-
role
public TokenOptions.Builder role(Role role)
Sets the role for the token. Each role defines a set of permissions granted to the token.- Parameters:
role
- The role for the token. Valid values are defined in the Role class:-
SUBSCRIBER
— A subscriber can only subscribe to streams. -
PUBLISHER
— A publisher can publish streams, subscribe to streams, and signal. (This is the default value if you do not specify a role.) -
MODERATOR
— In addition to the privileges granted to a publisher, a moderator can perform moderation functions, such as forcing clients to disconnect, to stop publishing streams, or to mute audio in published streams. See the Moderation developer guide.
-
-
expireTime
public TokenOptions.Builder expireTime(long expireTime)
Sets the expiration time for the token.- Parameters:
expireTime
- The expiration time, in seconds since the UNIX epoch. Pass in 0 to use the default expiration time of 24 hours after the token creation time. The maximum expiration time is 30 days after the creation time.
-
data
public TokenOptions.Builder data(java.lang.String data) throws InvalidArgumentException
A string containing connection metadata describing the end-user. For example, you can pass the user ID, name, or other data describing the end-user. The length of the string is limited to 1000 characters. This data cannot be updated once it is set.- Parameters:
data
- The connection metadata.- Throws:
InvalidArgumentException
-
initialLayoutClassList
public TokenOptions.Builder initialLayoutClassList(java.util.List<java.lang.String> initialLayoutClassList)
A List of class names (strings) to be used as the initial layout classes for streams published by the client. Layout classes are used in customizing the layout of videos in live streaming broadcasts and composed archives.- Parameters:
initialLayoutClassList
- The initial layout class list.
-
build
public TokenOptions build()
Builds the TokenOptions object.- Returns:
- The TokenOptions object.
-
-