Skip to content

Commit 234cca5

Browse files
authored
Merge pull request #580 from HugoLipeng/qvs/LINK-2757
LINK-2757 qvs add playExpireSec
2 parents ec19d32 + dcd1ebd commit 234cca5

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

src/main/java/com/qiniu/qvs/StreamManager.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public Response listStream(String namespaceId, int offset, int line, int qtype,
9191
静态模式获取流地址
9292
*/
9393
public Response staticPublishPlayURL(String namespaceId, String streamId, StaticLiveRoute staticLiveRoute) throws QiniuException {
94-
StringMap params = new StringMap().put("Domain", staticLiveRoute.getDomain()).
95-
put("DomainType", staticLiveRoute.getDomainType()).putNotNull("UrlExpireSec", staticLiveRoute.getUrlExpireSec());
94+
StringMap params = new StringMap().put("domain", staticLiveRoute.getDomain()).
95+
put("domainType", staticLiveRoute.getDomainType()).putNotNull("urlExpireSec", staticLiveRoute.getUrlExpireSec()).putNotNull("playExpireSec", staticLiveRoute.getPlayExpireSec());
9696
String url = String.format("%s/v1/namespaces/%s/streams/%s/domain", apiServer, namespaceId, streamId);
9797
return QvsResponse.post(url, params, client, auth);
9898
}
@@ -102,9 +102,10 @@ public Response staticPublishPlayURL(String namespaceId, String streamId, Static
102102
*/
103103
public Response dynamicPublishPlayURL(String namespaceId, String streamId, DynamicLiveRoute dynamicLiveRoute) throws QiniuException {
104104
StringMap params = new StringMap();
105-
params.put("PublishIP", dynamicLiveRoute.getPublishIP());
106-
params.put("PlayIP", dynamicLiveRoute.getPlayIP());
107-
params.putNotNull("UrlExpireSec", dynamicLiveRoute.getUrlExpireSec());
105+
params.put("publishIp", dynamicLiveRoute.getPublishIP());
106+
params.put("playIp", dynamicLiveRoute.getPlayIP());
107+
params.putNotNull("urlExpireSec", dynamicLiveRoute.getUrlExpireSec());
108+
params.putNotNull("playExpireSec", dynamicLiveRoute.getPlayExpireSec());
108109

109110
String url = String.format("%s/v1/namespaces/%s/streams/%s/urls", apiServer, namespaceId, streamId);
110111
return QvsResponse.post(url, params, client, auth);

src/main/java/com/qiniu/qvs/model/DynamicLiveRoute.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public class DynamicLiveRoute {
44
private String publishIP; // 推流端对外IP地址
55
private String playIP; // 拉流端对外IP地址
66
private int urlExpireSec; // 地址过期时间,urlExpireSec:100代表100秒后过期; 默认urlExpireSec:0,永不过期.
7+
private int playExpireSec; // 播放过期时间(单位为秒)
78

89
public DynamicLiveRoute(String publishIP, String playIP) {
910
this.publishIP = publishIP;
@@ -16,6 +17,13 @@ public DynamicLiveRoute(String publishIP, String playIP, int urlExpireSec) {
1617
this.urlExpireSec = urlExpireSec;
1718
}
1819

20+
public DynamicLiveRoute(String publishIP, String playIP, int urlExpireSec, int playExpireSec) {
21+
this.publishIP = publishIP;
22+
this.playIP = playIP;
23+
this.urlExpireSec = urlExpireSec;
24+
this.playExpireSec = playExpireSec;
25+
}
26+
1927
public String getPublishIP() {
2028
return publishIP;
2129
}
@@ -39,4 +47,12 @@ public int getUrlExpireSec() {
3947
public void setUrlExpireSec(int urlExpireSec) {
4048
this.urlExpireSec = urlExpireSec;
4149
}
50+
51+
public int getPlayExpireSec() {
52+
return playExpireSec;
53+
}
54+
55+
public void setPlayExpireSec(int playExpireSec) {
56+
this.playExpireSec = playExpireSec;
57+
}
4258
}

src/main/java/com/qiniu/qvs/model/StaticLiveRoute.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class StaticLiveRoute {
99
private String domain; // 域名
1010
private String domainType; // 域名类型 publishRtmp | liveRtmp | liveHls | liveHdl
1111
private int urlExpireSec; // 地址过期时间,urlExpireSec:100代表100秒后过期; 默认urlExpireSec:0,永不过期.
12+
private int playExpireSec; // 播放过期时间(单位为秒)
1213

1314
public StaticLiveRoute(String domain, String domainType) {
1415
this.domain = domain;
@@ -21,6 +22,13 @@ public StaticLiveRoute(String domain, String domainType, int urlExpireSec) {
2122
this.urlExpireSec = urlExpireSec;
2223
}
2324

25+
public StaticLiveRoute(String domain, String domainType, int urlExpireSec, int playExpireSec) {
26+
this.domain = domain;
27+
this.domainType = domainType;
28+
this.urlExpireSec = urlExpireSec;
29+
this.playExpireSec = playExpireSec;
30+
}
31+
2432
public String getDomain() {
2533
return domain;
2634
}
@@ -45,6 +53,14 @@ public void setUrlExpireSec(int urlExpireSec) {
4553
this.urlExpireSec = urlExpireSec;
4654
}
4755

56+
public int getPlayExpireSec() {
57+
return playExpireSec;
58+
}
59+
60+
public void setPlayExpireSec(int playExpireSec) {
61+
this.playExpireSec = playExpireSec;
62+
}
63+
4864
public String genStaticHLSFLVDomain(String nsId, String streamId, String key, boolean useHttps) {
4965
String path = "/" + nsId + "/" + streamId;
5066
String scheme = useHttps ? "https" : "http";

0 commit comments

Comments
 (0)