Skip to content

Commit 4561dad

Browse files
authored
Merge pull request #551 from QN-zhangzhuo/QRTC-1875
QRTC-1875合流V4版本API
2 parents 0f9fd41 + cc76994 commit 4561dad

File tree

9 files changed

+648
-0
lines changed

9 files changed

+648
-0
lines changed

src/main/java/com/qiniu/rtc/QRTCClient.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class QRTCClient {
2525
private ForwardService forwardService;
2626
private CallbackService callbackService;
2727
private MergeService mergeService;
28+
private MergeServiceV4 mergeServiceV4;
29+
2830
private AppService appService;
2931
// 应用ID
3032
private final String appId;
@@ -51,6 +53,7 @@ private void initService(Auth auth) {
5153
callbackService = new CallbackService(auth);
5254
mergeService = new MergeService(auth);
5355
appService = new AppService(auth);
56+
mergeServiceV4 = new MergeServiceV4(auth);
5457
}
5558

5659
/////////////////////////app service//////////////////////////////////////
@@ -281,6 +284,7 @@ public Response call() throws QiniuException {
281284
* @return
282285
* @throws QiniuException
283286
*/
287+
@Deprecated
284288
public QRTCResult<MergeResult> createMergeJob(final String roomName, final MergeParam mergeParam) throws QiniuException {
285289
ServiceCallFunc func = new ServiceCallFunc() {
286290
@Override
@@ -300,6 +304,7 @@ public Response call() throws QiniuException {
300304
* @return
301305
* @throws QiniuException
302306
*/
307+
@Deprecated
303308
public QRTCResult<MergeResult> updateMergeTrack(final MergeTrackParam mergeTrackParam, final String roomName, final String jobId)
304309
throws QiniuException {
305310
ServiceCallFunc updateMergeTrackFunc = new ServiceCallFunc() {
@@ -321,6 +326,7 @@ public Response call() throws QiniuException {
321326
* @return
322327
* @throws QiniuException
323328
*/
329+
@Deprecated
324330
public QRTCResult<MergeResult> updateMergeWatermarks(final WatermarksParam watermarksParam, final String roomName, final String jobId)
325331
throws QiniuException {
326332
ServiceCallFunc updateMergeWatermarksFunc = new ServiceCallFunc() {
@@ -341,6 +347,7 @@ public Response call() throws QiniuException {
341347
* @return
342348
* @throws QiniuException
343349
*/
350+
@Deprecated
344351
public QRTCResult<MergeResult> stopMergeJob(final String roomName, final String jobId) throws QiniuException {
345352
ServiceCallFunc func = new ServiceCallFunc() {
346353
@Override
@@ -351,6 +358,36 @@ public Response call() throws QiniuException {
351358
return buildResult(func, MergeResult.class);
352359
}
353360

361+
public QRTCResult<MergeResult> createMergeJob(final String roomName, final MergeJob job) throws QiniuException {
362+
ServiceCallFunc func = new ServiceCallFunc() {
363+
@Override
364+
public Response call() throws QiniuException {
365+
return mergeServiceV4.createMergeJob(job, appId, roomName);
366+
}
367+
};
368+
return buildResult(func, MergeResult.class);
369+
}
370+
371+
public QRTCResult<MergeResult> updateMergeJob(final String roomName, final MergeJob job) throws QiniuException {
372+
ServiceCallFunc func = new ServiceCallFunc() {
373+
@Override
374+
public Response call() throws QiniuException {
375+
return mergeServiceV4.updateMergeJob(job, appId, roomName);
376+
}
377+
};
378+
return buildResult(func, MergeResult.class);
379+
}
380+
381+
public QRTCResult<MergeResult> stopMergeJobById(final String roomName, final String jobId) throws QiniuException {
382+
ServiceCallFunc func = new ServiceCallFunc() {
383+
@Override
384+
public Response call() throws QiniuException {
385+
return mergeServiceV4.stopMergeJob(jobId, appId, roomName);
386+
}
387+
};
388+
return buildResult(func, MergeResult.class);
389+
}
390+
354391
/**
355392
* 构建最后的返回结果
356393
*
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
package com.qiniu.rtc.model;
2+
3+
import java.io.Serializable;
4+
5+
public class MediaConfig implements Serializable {
6+
7+
private static final long serialVersionUID = -2781620162179559305L;
8+
9+
/**
10+
* 输出帧率
11+
*/
12+
private int fps;
13+
14+
/**
15+
* 输出码率
16+
*/
17+
private int kbps;
18+
19+
/**
20+
* 指定输出宽度 必须为偶数
21+
*/
22+
private int width;
23+
24+
/**
25+
* 指定输出高度 必须为偶数
26+
*/
27+
private int height;
28+
29+
/**
30+
* 可选 是否保留用户最后一帧 默认false
31+
*/
32+
private boolean holdLastFrame;
33+
34+
/**
35+
* 可选 是否仅仅做音频合流
36+
*/
37+
private boolean audioOnly;
38+
39+
/**
40+
* 可选 指定拉伸模式 默认为 aspectFill
41+
*/
42+
private StretchModeEnum stretchMode;
43+
44+
public int getFps() {
45+
return fps;
46+
}
47+
48+
public void setFps(int fps) {
49+
this.fps = fps;
50+
}
51+
52+
public int getKbps() {
53+
return kbps;
54+
}
55+
56+
public void setKbps(int kbps) {
57+
this.kbps = kbps;
58+
}
59+
60+
public int getWidth() {
61+
return width;
62+
}
63+
64+
public void setWidth(int width) {
65+
this.width = width;
66+
}
67+
68+
public int getHeight() {
69+
return height;
70+
}
71+
72+
public void setHeight(int height) {
73+
this.height = height;
74+
}
75+
76+
public boolean isHoldLastFrame() {
77+
return holdLastFrame;
78+
}
79+
80+
public void setHoldLastFrame(boolean holdLastFrame) {
81+
this.holdLastFrame = holdLastFrame;
82+
}
83+
84+
public boolean isAudioOnly() {
85+
return audioOnly;
86+
}
87+
88+
public void setAudioOnly(boolean audioOnly) {
89+
this.audioOnly = audioOnly;
90+
}
91+
92+
public StretchModeEnum getStretchMode() {
93+
return stretchMode;
94+
}
95+
96+
public void setStretchMode(StretchModeEnum stretchMode) {
97+
this.stretchMode = stretchMode;
98+
}
99+
100+
@Override
101+
public String toString() {
102+
return "MediaConfig{" +
103+
"fps=" + fps +
104+
", kbps=" + kbps +
105+
", width=" + width +
106+
", height=" + height +
107+
", holdLastFrame=" + holdLastFrame +
108+
", audioOnly=" + audioOnly +
109+
", stretchMode=" + stretchMode +
110+
'}';
111+
}
112+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package com.qiniu.rtc.model;
2+
3+
import java.io.Serializable;
4+
5+
public class MediaInput implements Serializable {
6+
7+
private static final long serialVersionUID = -9162560559667684764L;
8+
9+
/**
10+
* 可选,默认为media类型。
11+
* 选值范围 image/media,media时 userId必须,image时imageUrl必填
12+
*/
13+
private String kind;
14+
15+
/**
16+
* kind == media 必填,用户加入房间时用户名
17+
*/
18+
private String userId;
19+
20+
/**
21+
* kind == image 必填,图片地址。
22+
*/
23+
private String url;
24+
25+
/**
26+
* 可选,发布多路时候用于区分不同输入
27+
*/
28+
private String tag;
29+
30+
/**
31+
* 可选,任务为basic并且多路进行合流时候必填
32+
*/
33+
private MediaPosition position;
34+
35+
/**
36+
* 可选,拉伸模式 默认为 aspectFill
37+
*/
38+
private StretchModeEnum stretchMode;
39+
40+
public String getUserId() {
41+
return userId;
42+
}
43+
44+
public void setUserId(String userId) {
45+
this.userId = userId;
46+
}
47+
48+
public String getTag() {
49+
return tag;
50+
}
51+
52+
public void setTag(String tag) {
53+
this.tag = tag;
54+
}
55+
56+
public String getUrl() {
57+
return url;
58+
}
59+
60+
public void setUrl(String url) {
61+
this.url = url;
62+
}
63+
64+
public String getKind() {
65+
return kind;
66+
}
67+
68+
public void setKind(String kind) {
69+
this.kind = kind;
70+
}
71+
72+
73+
public StretchModeEnum getStretchMode() {
74+
return stretchMode;
75+
}
76+
77+
public void setStretchMode(StretchModeEnum stretchMode) {
78+
this.stretchMode = stretchMode;
79+
}
80+
81+
public MediaPosition getPosition() {
82+
return position;
83+
}
84+
85+
public void setPosition(MediaPosition position) {
86+
this.position = position;
87+
}
88+
89+
@Override
90+
public String toString() {
91+
return "MediaInput{" +
92+
"userId='" + userId + '\'' +
93+
", tag='" + tag + '\'' +
94+
", url='" + url + '\'' +
95+
", kind='" + kind + '\'' +
96+
", stretchMode=" + stretchMode +
97+
", position=" + position +
98+
'}';
99+
}
100+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.qiniu.rtc.model;
2+
3+
import java.io.Serializable;
4+
5+
public class MediaOutput implements Serializable {
6+
7+
private static final long serialVersionUID = 5010528238721566857L;
8+
9+
/**
10+
* 现仅支持 rtmp
11+
*/
12+
private String type;
13+
14+
/**
15+
* rtmp地址, example: rtmp://qiniu.com/stream
16+
*/
17+
private String url;
18+
19+
public MediaOutput() {
20+
}
21+
22+
public MediaOutput(String type, String url) {
23+
this.type = type;
24+
this.url = url;
25+
}
26+
27+
public String getType() {
28+
return type;
29+
}
30+
31+
public void setType(String type) {
32+
this.type = type;
33+
}
34+
35+
public String getUrl() {
36+
return url;
37+
}
38+
39+
public void setUrl(String url) {
40+
this.url = url;
41+
}
42+
43+
@Override
44+
public String toString() {
45+
return "MediaOutput{" +
46+
"type='" + type + '\'' +
47+
", url='" + url + '\'' +
48+
'}';
49+
}
50+
}

0 commit comments

Comments
 (0)