Package com.opentok
Class TokenOptions.Builder
java.lang.Object
com.opentok.TokenOptions.Builder
- Enclosing class:
- TokenOptions
Use this class to create a TokenOptions object.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the TokenOptions object.A string containing connection metadata describing the end-user.expireTime
(long expireTime) Sets the expiration time for the token.initialLayoutClassList
(List<String> initialLayoutClassList) A List of class names (strings) to be used as the initial layout classes for streams published by the client.Sets the role for the token.Use this method to generate a legacy T1 token instead of a JWT.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
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
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
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.
-
useLegacyT1Token
Use this method to generate a legacy T1 token instead of a JWT.- Returns:
- This builder.
- Since:
- 4.15.0
-
build
Builds the TokenOptions object.- Returns:
- The TokenOptions object.
-