File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ import com .opentok .api .API_Config ;
2
+ import com .opentok .api .OpenTokSDK ;
3
+ import com .opentok .api .constants .SessionProperties ;
4
+ import com .opentok .api .constants .RoleConstants ;
5
+ import com .opentok .exception .OpenTokException ;
6
+
7
+ class Test {
8
+ public static void main (String argv []) throws OpenTokException {
9
+ OpenTokSDK sdk = new OpenTokSDK (API_Config .API_KEY ,API_Config .API_SECRET );
10
+
11
+ //Generate a token
12
+ String s = sdk .generate_token ("session" );
13
+ System .out .println (s );
14
+
15
+ System .out .println (sdk .generate_token ("session" ,RoleConstants .PUBLISHER ));
16
+ System .out .println (sdk .generate_token ("session" ,RoleConstants .SUBSCRIBER ));
17
+ System .out .println (sdk .generate_token ("session" ,RoleConstants .MODERATOR ));
18
+
19
+
20
+
21
+ //Generate a basic session
22
+ System .out .println (sdk .create_session ().session_id );
23
+
24
+ System .out .println ();
25
+
26
+ //Generate Session Properties for a session
27
+ SessionProperties sp = new SessionProperties ();
28
+
29
+ //Add SessionProperties here if any are needed (e.g. p2p)
30
+
31
+ //Generate a session with a location hint and session properties
32
+ System .out .println (sdk .create_session ("127.0.0.1" , sp ).session_id );
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments