Skip to content

Commit ba8edcd

Browse files
jeffswartzManik Sachdeva
authored andcommitted
Docs updates for 4.3.0 API additions (#162)
* Docs updates for 4.3.0 API additions * Minor docs edit * README edits * Fixing a typo.
1 parent ac373d9 commit ba8edcd

12 files changed

+332
-233
lines changed

README.md

Lines changed: 165 additions & 127 deletions
Large diffs are not rendered by default.

src/main/java/com/opentok/Archive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public String getName() {
141141
}
142142

143143
/**
144-
* The name of the archive.
144+
* The resolution of the archive.
145145
*/
146146
public String getResolution() {
147147
return resolution;

src/main/java/com/opentok/ArchiveLayout.java

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,54 @@
1111
import com.fasterxml.jackson.annotation.JsonValue;
1212

1313
/**
14-
* Represents a <a href="https://tokbox.com/developer/guides/archiving/layout-control.html">layout configuration</a>
15-
* for a composed archive
14+
* Represents a <a href="https://tokbox.com/developer/guides/archiving/layout-control.html">layout
15+
* configuration</a> for a composed archive.
1616
*/
1717
@JsonFormat(shape= JsonFormat.Shape.OBJECT)
1818
public class ArchiveLayout {
1919
private Type type;
2020
private String stylesheet;
2121

22-
public ArchiveLayout(Type type, String stylesheet) {
22+
/**
23+
* Do not call the <code>ArchiveLayout()</code> constructor. To set the layout of an
24+
* archive, call the {@link OpenTok#setArchiveLayout(String archiveId, ArchiveProperties properties)} method.
25+
*/
26+
public ArchiveLayout(Type type, String stylesheet) {
2327
this.type = type;
2428
this.stylesheet = stylesheet;
2529
}
2630

31+
/**
32+
* Do not call the <code>ArchiveLayout()</code> constructor. To set the layout of an
33+
* archive, call the {@link OpenTok#setArchiveLayout(String archiveId, ArchiveProperties properties)} method. See
34+
*/
2735
public ArchiveLayout(Type type) {
2836
this.type = type;
2937
}
3038

39+
/**
40+
* Enumerates <code>type</code> values for the layout.
41+
*/
3142
public enum Type {
43+
/**
44+
* Represents the picture-in-picture (pip) layout type.
45+
*/
3246
PIP("pip"),
47+
/**
48+
* Represents the picture-in-picture (pip) layout type.
49+
*/
3350
BESTFIT("bestFit"),
51+
/**
52+
* Represents the vertical presentation layout type.
53+
*/
3454
VERTICAL("verticalPresentation"),
55+
/**
56+
* Represents the horizontal presentation layout type.
57+
*/
3558
HORIZONTAL("horizontalPresentation"),
59+
/**
60+
* Represents a custom layout type.
61+
*/
3662
CUSTOM("custom");
3763

3864
private String serialized;
@@ -47,18 +73,30 @@ public String toString() {
4773
}
4874
}
4975

76+
/**
77+
* Returns the layout type.
78+
*/
5079
public Type getType() {
5180
return type;
5281
}
5382

83+
/**
84+
* Sets the layout type.
85+
*/
5486
public void setType(Type type) {
5587
this.type = type;
5688
}
5789

90+
/**
91+
* Returns the stylesheet for a custom layout.
92+
*/
5893
public String getStylesheet() {
5994
return stylesheet;
6095
}
6196

97+
/**
98+
* Sets the stylesheet for a custom layout.
99+
*/
62100
public void setStylesheet(String stylesheet) {
63101
this.stylesheet = stylesheet;
64102
}

src/main/java/com/opentok/ArchiveProperties.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ public Builder name(String name) {
7070
/**
7171
* Call this method to set the resolution of the archive.
7272
*
73-
* @param resolution The resolution of the archive, either "640x480" (SD, the default) or "1280x720" (HD).
74-
* This property only applies to composed archives.
75-
* If you set this property and set the outputMode property to "individual", the call in the API method results in an error.
73+
* @param resolution The resolution of the archive, either "640x480" (SD, the default) or
74+
* "1280x720" (HD). This property only applies to composed archives. If you set this
75+
* and set the outputMode property to "individual", the call in the API method results in
76+
* an error.
7677
*
77-
* @return The ArchiveProperties.Builder object with the name setting.
78+
* @return The ArchiveProperties.Builder object with the resolution setting.
7879
*/
7980
public Builder resolution(String resolution) {
8081
this.resolution = resolution;

src/main/java/com/opentok/Broadcast.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.util.Map;
1818

1919
/**
20-
* Represents an archive of an OpenTok session.
20+
* Represents a live streaming broadcast of an OpenTok session.
2121
*/
2222
@JsonIgnoreProperties(ignoreUnknown=true)
2323
public class Broadcast {
@@ -32,9 +32,17 @@ public class Broadcast {
3232
private List<Rtmp> rtmpList = new ArrayList<>();
3333
private String hls;
3434

35+
/**
36+
* Do not call the <code>Broadcast()</code> constructor. To start a live streaming broadcast,
37+
* call the {@link OpenTok#startBroadcast OpenTok.startBroadcast()} method.
38+
*/
3539
protected Broadcast() {
3640
}
3741

42+
/**
43+
* Do not call the <code>makeBroadcast()</code> method. To start a live streaming broadcast,
44+
* call the {@link OpenTok#startBroadcast OpenTok.startBroadcast()} method.
45+
*/
3846
@JsonCreator
3947
public static Broadcast makeBroadcast() {
4048
return new Broadcast();
@@ -48,48 +56,51 @@ public String getId() {
4856
}
4957

5058
/**
51-
* The session ID of the OpenTok session associated with this archive.
59+
* The session ID of the OpenTok session associated with this broadcast.
5260
*/
5361
public String getSessionId() {
5462
return sessionId;
5563
}
5664

5765

5866
/**
59-
* The OpenTok API key associated with the archive.
67+
* The OpenTok API key associated with the broadcast.
6068
*/
6169
public int getProjectId() {
6270
return projectId;
6371
}
6472

6573
/**
66-
* The time at which the archive was created, in milliseconds since the Unix epoch.
74+
* The time at which the broadcast was started, in milliseconds since the Unix epoch.
6775
*/
6876
public long getCreatedAt() {
6977
return createdAt;
7078
}
7179
/**
72-
* The time at which the archive was created, in milliseconds since the Unix epoch.
80+
* The time at which the broadcast was updated, in milliseconds since the Unix epoch.
7381
*/
7482
public long getUpdatedAt() {
7583
return updatedAt;
7684
}
7785
/**
78-
* The name of the archive.
86+
* The broadcast resolution.
7987
*/
8088
public String getResolution() {
8189
return resolution;
8290
}
8391

8492
/**
85-
* The name of the archive.
93+
* The broadcast status, either "started" or "stopped".
8694
*/
8795
public String getStatus() {
8896
return status;
8997
}
9098
/**
91-
* The name of the archive.
92-
*
99+
* Details on the HLS and RTMP broadcast streams. For an HLS stream, the URL is provided.
100+
* See the <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/">OpenTok
101+
* live streaming broadcast developer guide</a> for more information on how to use this URL.
102+
* For each RTMP stream, the RTMP server URL and stream name are provided, along with the RTMP
103+
* stream's status.
93104
*/
94105
@JsonProperty("broadcastUrls")
95106
private void unpack(Map<String,Object> broadcastUrls) {
@@ -106,13 +117,13 @@ private void unpack(Map<String,Object> broadcastUrls) {
106117
}
107118
}
108119
/**
109-
* The name of the archive if present else null.
120+
* The HLS URL (if there is one) of the broadcast.
110121
*/
111122
public String getHls() {
112123
return hls;
113124
}
114125
/**
115-
* The name of the archive.
126+
* A list of RTMP URLs (if there are any) of the broadcast.
116127
*/
117128
public List<Rtmp> getRtmpList() {
118129
return rtmpList;
@@ -124,7 +135,6 @@ public String toString() {
124135
} catch (Exception e) {
125136
return "";
126137
}
127-
128138
}
129139

130140
}

src/main/java/com/opentok/BroadcastLayout.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,23 @@
77
*/
88
package com.opentok;
99

10+
/**
11+
* Represents a <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#configuring-video-layout-for-opentok-live-streaming-broadcasts">layout
12+
* configuration</a> for a live streaming broadcast.
13+
*/
1014
public class BroadcastLayout extends ArchiveLayout {
15+
/**
16+
* Do not call the <code>BroadcastLayout()</code> constructor. To set the layout of
17+
* a live streaming broadcast, call the {@link OpenTok#setBroadcastLayout(String broadcastId, BroadcastProperties properties)} method.
18+
*/
1119
public BroadcastLayout(Type type, String stylesheet) {
1220
super(type, stylesheet);
1321
}
1422

23+
/**
24+
* Do not call the <code>BroadcastLayout()</code> constructor. To set the layout of
25+
* a live streaming broadcast, call the {@link OpenTok#setBroadcastLayout(String broadcastId, BroadcastProperties properties)} method.
26+
*/
1527
public BroadcastLayout(Type type) {
1628
super(type);
1729
}

src/main/java/com/opentok/BroadcastProperties.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
/**
1717
* Defines values for the <code>properties</code> parameter of the
18-
* {@link OpenTok#createSession(SessionProperties)} method.
19-
*
20-
* @see OpenTok#createSession(com.opentok.SessionProperties properties)
18+
* {@link OpenTok#startBroadcast(String sessionId, BroadcastProperties properties)} method.
2119
*/
2220
public class BroadcastProperties {
2321

@@ -50,9 +48,9 @@ public static class Builder {
5048

5149

5250
/**
53-
* Call this method to customize the layout of the broadcast
51+
* Call this method to customize the layout of the broadcast.
5452
*
55-
* @param layout An object of type {@link BroadcastLayout} .
53+
* @param layout An object of type {@link BroadcastLayout}.
5654
*
5755
* @return The BroadcastProperties.Builder object with the layout setting.
5856
*/
@@ -61,9 +59,12 @@ public Builder layout(BroadcastLayout layout){
6159
return this;
6260
}
6361
/**
64-
* Call this method to set the time duration, in seconds, of the broadcast . The default is 7200 seconds
62+
* Call this method to set the maximum duration, in seconds, of the broadcast.
63+
* The broadcast will automatically stop when the maximum duration is reached.
64+
* You can set the maximum duration to a value from 60 (60 seconds) to 36000 (10 hours).
65+
* The default maximum duration is 2 hours (7200 seconds).
6566
*
66-
* @param maxDuration The maximum time duration in seconds
67+
* @param maxDuration The maximum duration in seconds.
6768
*
6869
* @return The BroadcastProperties.Builder object with the maxDuration setting.
6970
*/
@@ -87,9 +88,10 @@ public Builder hasHls(boolean hasHls) {
8788
return this;
8889
}
8990
/**
90-
* Call this method to set rtmp list of the broadcast stream. A limit of 5 RtmpProperties object is enforced.
91+
* Call this method to set a list of RTMP broadcast streams. There is a limit of
92+
* 5 RTMP streams.
9193
*
92-
* @param rtmpProps The rtmp properties object .
94+
* @param rtmpProps The {@link RtmpProperties} object defining the RTMP streams.
9395
*
9496
* @return The BroadcastProperties.Builder object with the list of RtmpProperties setting.
9597
*/

src/main/java/com/opentok/OpenTok.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,7 @@ public void deleteArchive(String archiveId) throws OpenTokException {
497497
*
498498
* @param archiveId {String} The archive ID.
499499
*
500-
* @param properties This ArchiveProperties object defines options for the archive.
501-
*
502-
* The ArchiveProperties values has the following constraints:
503-
* Valid layout type values are "bestFit" (best fit), "custom" (custom), "horizontalPresentation" (horizontal presentation),
504-
* "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)).
505-
* If you specify a "custom" layout type, set the stylesheet property to the stylesheet.
506-
* (For other layout types, do not set the stylesheet property.)
507-
* Refer https://tokbox.com/developer/rest/#change_composed_archive_layout for more details
500+
* @param properties This ArchiveProperties object defining the arachive layout.
508501
*/
509502
public void setArchiveLayout(String archiveId, ArchiveProperties properties) throws OpenTokException {
510503
if (StringUtils.isEmpty(archiveId) || properties == null) {
@@ -528,11 +521,12 @@ public void setArchiveLayout(String archiveId, ArchiveProperties properties) thr
528521
* For more information on broadcasting, see the
529522
* <a href="https://tokbox.com/developer/guides/broadcast/">Broadcast developer guide.</a>
530523
*
531-
* @param sessionId The session ID of the broadcasting session
524+
* @param sessionId The session ID of the OpenTok session to broadcast.
532525
*
533526
* @param properties This BroadcastProperties object defines options for the broadcast.
534527
*
535-
* @return The Broadcast object. This object includes properties defining the archive, including the archive ID.
528+
* @return The Broadcast object. This object includes properties defining the broadcast,
529+
* including the broadcast ID.
536530
*/
537531
public Broadcast startBroadcast(String sessionId, BroadcastProperties properties) throws OpenTokException {
538532
if (StringUtils.isEmpty(sessionId) || (properties == null)) {
@@ -590,19 +584,13 @@ public Broadcast getBroadcast(String broadcastId) throws OpenTokException {
590584
}
591585
/**
592586
* Sets the layout type for the broadcast. For a description of layout types, see
593-
* <a href="https://tokbox.com/developer/guides/archiving/layout-control.html">Customizing
594-
* the video layout for composed archives</a>.
587+
* <a href="hhttps://tokbox.com/developer/guides/broadcast/live-streaming/#configuring-video-layout-for-opentok-live-streaming-broadcasts">Configuring
588+
* video layout for OpenTok live streaming broadcasts</a>.
595589
*
596590
* @param broadcastId {String} The broadcast ID.
597591
*
598-
* @param properties This BroadcastProperties object defines options for the archive.
599-
*
600-
* The ArchiveProperties values has the following constraints:
601-
* Valid layout type values are "bestFit" (best fit), "custom" (custom), "horizontalPresentation" (horizontal presentation),
602-
* "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)).
603-
* If you specify a "custom" layout type, set the stylesheet property to the stylesheet.
604-
* (For other layout types, do not set the stylesheet property.)
605-
* Refer https://tokbox.com/developer/rest/#change_composed_archive_layout for more details
592+
* @param properties This BroadcastProperties object that defines layout options for
593+
* the broadcast.
606594
*/
607595
public void setBroadcastLayout(String broadcastId, BroadcastProperties properties) throws OpenTokException {
608596
if (StringUtils.isEmpty(broadcastId) || properties == null) {

src/main/java/com/opentok/Rtmp.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
1111

1212
/**
13-
* Represents a stream in an OpenTok session.
13+
* Represents an RTMP stream in an OpenTok session.
1414
*/
1515
@JsonIgnoreProperties(ignoreUnknown=true)
1616

@@ -29,7 +29,7 @@ public String getId() {
2929
return id;
3030
}
3131
/**
32-
* The server URL.
32+
* The RTMP server URL.
3333
*/
3434
public void setServerUrl(String serverUrl) {
3535
this.serverUrl = serverUrl;
@@ -46,7 +46,5 @@ public void setStreamName(String streamName) {
4646
public String getStreamName() {
4747
return streamName;
4848
}
49-
50-
5149
}
5250

0 commit comments

Comments
 (0)