Skip to content

Commit bdac6b3

Browse files
authored
Merge pull request #534 from qrtc/features/rtc_v8.0
七牛云实时音视频QRTC增加接口
2 parents ab44141 + 8fa479f commit bdac6b3

25 files changed

+1175
-116
lines changed

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ jacocoTestReport {
2222
dependencies {
2323
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.14.4'
2424
implementation 'com.google.code.gson:gson:2.8.5'
25+
implementation 'org.projectlombok:lombok:1.18.22'
2526
testImplementation group: 'com.qiniu', name: 'happy-dns-java', version: '0.1.6'
2627
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
2728
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
29+
compileOnly 'org.projectlombok:lombok:1.18.22'
30+
annotationProcessor 'org.projectlombok:lombok:1.18.22'
31+
testCompileOnly 'org.projectlombok:lombok:1.18.22'
32+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
2833
}
2934

3035
test {

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.qiniu.rtc;
2+
3+
import java.util.Map;
4+
import java.util.concurrent.ConcurrentHashMap;
5+
6+
/**
7+
* 七牛云rtc java sdk
8+
* qrtc java sdk api
9+
*
10+
* @QRTC TEAM
11+
* @Version 8.0
12+
*/
13+
public class QRTC {
14+
//版本号
15+
public static final String VERSION = "8.0";
16+
17+
private QRTC() {
18+
19+
}
20+
21+
private volatile static QRTCClient client = null;
22+
23+
private static final Map<String, QRTCClient> holder = new ConcurrentHashMap<>(16);
24+
25+
/**
26+
* 初始化QRTCClient
27+
*
28+
* @return
29+
*/
30+
public static QRTCClient init(String accessKey, String secretKey, String appId) {
31+
if (null == appId || null == accessKey || null == secretKey) {
32+
throw new IllegalArgumentException("params cannot be null...");
33+
}
34+
if (holder.containsKey(appId)) {
35+
return holder.get(appId);
36+
}
37+
client = new QRTCClient(accessKey, secretKey, appId);
38+
holder.put(appId, client);
39+
return holder.get(appId);
40+
}
41+
42+
/**
43+
* 根据appId 获取当前的client
44+
*
45+
* @param appId
46+
* @return
47+
*/
48+
public static QRTCClient getClient(String appId) {
49+
return holder.get(appId);
50+
}
51+
}

0 commit comments

Comments
 (0)