Android 如何实现Quickblox视频聊天
我想将quickblox videochat集成到我的android应用程序中,但我找不到合适的文档,我已经浏览了quickblox网站,但它没有帮助,也不容易理解,如果有人帮助我,我将不胜感激 首先,您需要启用信令。使用下面的代码,您可以拨打或接听电话Android 如何实现Quickblox视频聊天,android,quickblox,videochat,Android,Quickblox,Videochat,我想将quickblox videochat集成到我的android应用程序中,但我找不到合适的文档,我已经浏览了quickblox网站,但它没有帮助,也不容易理解,如果有人帮助我,我将不胜感激 首先,您需要启用信令。使用下面的代码,您可以拨打或接听电话 QBRTCClient.getInstance(context).prepareToProcessCalls(); QBChatService.getInstance().getVideoChatWebRTCSignalingManager()
QBRTCClient.getInstance(context).prepareToProcessCalls();
QBChatService.getInstance().getVideoChatWebRTCSignalingManager()
.addSignalingManagerListener(new QBVideoChatSignalingManagerListener() {
@Override
public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally) {
if (!createdLocally) {
QBRTCClient.getInstance(context).addSignaling((QBWebRTCSignaling) qbSignaling);
}
}
});
然后,您需要添加会话回调来帮助您接听来电
QBRTCClient.getInstance(context).addSessionCallbacksListener(this);
现在,它覆盖了onReceiveNewSession中的一个,在这个方法中,当对手向您发出呼叫时,您将收到一个呼叫
要拨打电话,
QBRTCTypes.QBConferenceType qbConferenceType = QB_CONFERENCE_TYPE_VIDEO;
List<Integer> opponents = new ArrayList<Integer>();
opponents.add(userid); //12345 - QBUser ID
//Set user information
Map<String, String> userInfo = new HashMap<>();
userInfo.put("key", "value");
//Init session
QBRTCSession session = QBRTCClient.getInstance(this).createNewSessionWithOpponents(opponents, qbConferenceType);
//Start call
session.startCall(userInfo);
获取错误-程序类型已存在:org.webrtc.CameraEnumerationAndroid$CaptureFormat消息{kind=Error,text=Program类型已存在:org.webrtc.CameraEnumerationAndroid$CaptureFormat,sources=[未知源文件],工具名=可选的.of(D8)} 这是我的应用程序级别
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.mindinfo.xchangemall.xchangemall"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-
rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
repositories {
mavenCentral()
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v2-rev295-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
//noinspection GradleCompatible
implementation 'com.android.support:multidex:1.0.3'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.facebook.android:facebook-android-sdk:4.27.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.yahoo.mobile.client.android.util.rangeseekbar:rangeseekbar-
library:0.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.github.stfalcon:multiimageview:0.1'
implementation 'com.lorentzos.swipecards:library:1.0.9'
implementation 'com.github.midorikocak:currency-picker-android:1.1.9'
implementation 'com.baoyz.pullrefreshlayout:library:1.2.0'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-analytics:16.0.0'
implementation 'com.google.firebase:firebase-crash:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.google.firebase:firebase-invites:16.0.0'
implementation 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation "com.quickblox:quickblox-android-sdk-videochat-webrtc:3.8.1"
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
这是我的项目级渐变:-
buildscript {
// ext.kotlin_version = '1.2.30'
// ext.roomVersion = '1.0.0'
repositories {
mavenCentral()
google()
jcenter()
maven {
url 'https://maven.google.com/' }
maven {
url 'https://maven.fabric.io/public'
}
maven { url "https://raw.githubusercontent.com/HyphenateInc/Hyphenate-
SDK-Android/master/repository" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-
releases/raw/master/"
}
maven {
url 'https://maven.google.com/' }
maven { url "https://raw.githubusercontent.com/HyphenateInc/Hyphenate-
SDK-Android/master/repository" }
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
添加quickblox依赖项时出错,错误:-程序类型已存在:org.webrtc.CameraEnumerationAndroid$CaptureFormat消息{kind=error,text=Program type已存在:org.webrtc.CameraEnumerationAndroid$CaptureFormat,sources=[未知源文件],tool name=Optional.of(D8)}太长了,如何共享我的代码,我刚刚添加了quickblox依赖项:实现“com.quickblox:quickblox android sdk videochat webrtc:3.7.0”,并超越了仅限错误共享的构建。gradle文件(项目和应用程序模块)足以指导我解决这个问题。无法在评论中发送所有gradle代码,您知道其他选项吗?
buildscript {
// ext.kotlin_version = '1.2.30'
// ext.roomVersion = '1.0.0'
repositories {
mavenCentral()
google()
jcenter()
maven {
url 'https://maven.google.com/' }
maven {
url 'https://maven.fabric.io/public'
}
maven { url "https://raw.githubusercontent.com/HyphenateInc/Hyphenate-
SDK-Android/master/repository" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-
releases/raw/master/"
}
maven {
url 'https://maven.google.com/' }
maven { url "https://raw.githubusercontent.com/HyphenateInc/Hyphenate-
SDK-Android/master/repository" }
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}