Skip to content

Commit

Permalink
Merge pull request #58 from MJLblabla/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
MJLblabla authored Jan 18, 2023
2 parents 3a70818 + eac3214 commit 73db014
Show file tree
Hide file tree
Showing 27 changed files with 115 additions and 62 deletions.
2 changes: 1 addition & 1 deletion app-sdk/depends_sdk_qrtc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('qndroid_rtc-5.2.0.aar'))
artifacts.add("default", file('qndroid_rtc-5.2.2.aar'))
Binary file not shown.
2 changes: 1 addition & 1 deletion app-sdk/qlive-sdk-uikit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('qlive-uikit-1.0.6.aar'))
artifacts.add("default", file('qlive-uikit-1.0.7.aar'))
Binary file removed app-sdk/qlive-sdk-uikit/qlive-uikit-1.0.6.aar
Binary file not shown.
Binary file added app-sdk/qlive-sdk-uikit/qlive-uikit-1.0.7.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion app-sdk/qlive-sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('qlive-sdk-1.0.6.aar'))
artifacts.add("default", file('qlive-sdk-1.0.7.aar'))
Binary file removed app-sdk/qlive-sdk/qlive-sdk-1.0.6.aar
Binary file not shown.
Binary file added app-sdk/qlive-sdk/qlive-sdk-1.0.7.aar
Binary file not shown.
8 changes: 2 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ dependencies {
implementation depend.appcompat()
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "jp.wasabeef:glide-transformations:3.0.1"

implementation 'com.google.android.material:material:1.4.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
1 change: 1 addition & 0 deletions app/src/main/java/com/qlive/qnlivekit/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import okhttp3.Request

class App : Application() {
companion object {
//模拟接入方的登录获取token地址 - (不是低代码的服务地址)
val demo_url = "https://niucube-api.qiniu.com"
// val demo_url="http://10.200.20.28:5080"
}
Expand Down
16 changes: 9 additions & 7 deletions app/src/main/res/layout/custom_layout_ktv_pusher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@
<com.qlive.rtclive.QPushTextureView
android:id="@+id/preTextureView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent" >

<com.qlive.uikitgift.GiftTrackManagerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_vertical" />
</com.qlive.rtclive.QPushTextureView>

<!-- pk预览-->
<com.qlive.uikitpk.PKAnchorPreview
Expand Down Expand Up @@ -104,7 +111,7 @@

<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="1dp"
android:layout_weight="1"
tools:background="#2234ff" />

Expand Down Expand Up @@ -293,11 +300,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 礼物轨道-->
<com.qlive.uikitgift.GiftTrackManagerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_vertical" />

</com.qlive.uikit.component.FrameLayoutSlidingCover>
</com.qlive.uikit.component.TouchEventBusViewPager>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/custom_layout_pusher_no_shoping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<com.qlive.uikit.component.FuncCPTDefaultKeyDownMonitor
android:layout_width="0dp"
android:layout_height="0dp" />

<!-- 直播违规警告 功能组件-->
<com.qlive.uikit.component.FuncCPTRoomWarnMonitor
android:layout_width="0dp"
android:layout_height="0dp" />
Expand Down Expand Up @@ -103,7 +103,7 @@

<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="1dp"
android:layout_weight="1"
tools:background="#2234ff" />

Expand Down
4 changes: 2 additions & 2 deletions doc/sdkbuilder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ android {
fataar {
transitive = true
}
def uikitversion = 'qlive-uikit-1.0.6'
def qliveversion = 'qlive-sdk-1.0.6'
def uikitversion = 'qlive-uikit-1.0.7'
def qliveversion = 'qlive-sdk-1.0.7'

task makeAAR(type: Copy) {
def localProperties = new Properties()
Expand Down
33 changes: 33 additions & 0 deletions liveroom-core/src/main/java/com/qlive/core/QLiveErrorCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.qlive.core;

public class QLiveErrorCode {
/**
* 未知错误
*/
public static int UNKNOWN = -1;

/**
* 没有登录
*/
public static int NOT_LOGGED_IN = -2;

/**
* 用户已取消操作
*/
public static int CANCELED_JOIN = -3;

/**
* 没有相应的权限
*/
public static int NO_PERMISSION = -4;

/**
* 当前用户不是房间成员
*/
public static int NOT_A_ROOM_MEMBER = -5;

/**
* 不是连麦成员
*/
public static int NOT_A_LINKER_MEMBER = -6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.qlive.rtminvitation.*
import com.qlive.jsonutil.JsonUtils
import com.qlive.core.QClientLifeCycleListener
import com.qlive.core.*
import com.qlive.core.QLiveErrorCode.NOT_A_ROOM_MEMBER
import com.qlive.core.been.QInvitation
import com.qlive.core.been.QLiveRoomInfo
import com.qlive.core.been.QLiveUser
Expand Down Expand Up @@ -88,7 +89,7 @@ open class QInvitationHandlerImpl(private val ivName: String) : QInvitationHandl
callBack: QLiveCallBack<QInvitation>?
) {
if (currentRoomInfo == null) {
callBack?.onError(-1, "roomInfo==null")
callBack?.onError(NOT_A_ROOM_MEMBER, "roomInfo==null")
return
}
backGround {
Expand Down
12 changes: 2 additions & 10 deletions liveroom-core/src/main/java/com/qlive/coreimpl/QLiveDataSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,11 @@ class QLiveDataSource {
}

suspend fun unPubRoom(liveId: String): QLiveRoomInfo {
return HttpClient.httpClient.delete(
"/client/live/room/${liveId}",
"{}",
QLiveRoomInfo::class.java
)
return HttpClient.httpClient.delete("/client/live/room/${liveId}", "{}", QLiveRoomInfo::class.java)
}

suspend fun joinRoom(liveId: String): QLiveRoomInfo {
return HttpClient.httpClient.post(
"/client/live/room/user/${liveId}",
"{}",
QLiveRoomInfo::class.java
)
return HttpClient.httpClient.post("/client/live/room/user/${liveId}", "{}", QLiveRoomInfo::class.java)
}

suspend fun leaveRoom(liveId: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,13 @@ class QNIMAdapter : RtmAdapter {
fun init(config: BMXSDKConfig, context: Context) {
if (QNIMClient.isInit()) {
QNIMClient.getUserManager()?.removeUserListener(mBMXUserServiceListener)
QNIMClient.getChatManager()?.removeChatListener(mChatListener)
}
QNIMClient.init(config)
mContext = context
isInit = true
QNIMClient.getUserManager().addUserListener(mBMXUserServiceListener)
QNIMClient.getChatManager().addChatListener(mChatListener)
}

fun loginOut(callBack: BMXCallBack) {
Expand Down Expand Up @@ -400,6 +402,5 @@ class QNIMAdapter : RtmAdapter {
) {
this.c2cMessageReceiver = c2cMessageReceiver
this.channelMsgReceiver = channelMsgReceiver
QNIMClient.getChatManager().addChatListener(mChatListener)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import com.qlive.rtm.RtmManager
object QNIMManager {

val mRtmAdapter by lazy { com.qlive.qnim.QNIMAdapter() }
fun setRtmAdapter() {
RtmManager.setRtmAdapter(mRtmAdapter)
}

fun init(appId: String, context: Context) {
mRtmAdapter.init(QNIMConfig.imSDKConfigGetter.invoke(appId, context), context)
RtmManager.setRtmAdapter(mRtmAdapter)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@ interface QRenderCallback {
}

enum class PreviewMode(val intValue: Int) {
/**
原始尺寸
*/
ASPECT_RATIO_ORIGIN(0),

/**
* 适应屏幕
*/
ASPECT_RATIO_FIT_PARENT(1),

/**
* 全屏铺满
*/
ASPECT_RATIO_PAVED_PARENT(2),
ASPECT_RATIO_16_9(3),
ASPECT_RATIO_4_3(4),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import com.qlive.linkmicservice.QLinkMicServiceImpl.Companion.liveroom_miclinker
import com.qlive.linkmicservice.QLinkMicServiceImpl.Companion.liveroom_miclinker_microphone_mute
import com.qlive.coreimpl.*
import com.qlive.core.*
import com.qlive.core.QLiveErrorCode.NOT_A_LINKER_MEMBER
import com.qlive.core.QLiveErrorCode.NOT_A_ROOM_MEMBER
import com.qlive.core.been.QLiveRoomInfo
import com.qlive.coreimpl.model.MuteMode
import com.qlive.coreimpl.model.UidMode
Expand Down Expand Up @@ -181,7 +183,7 @@ internal class QAudienceMicHandlerImpl(private val micLinkContext: MicLinkContex
) {
mMicListJob.cancel()
if (currentRoomInfo == null) {
callBack?.onError(-1, "roomInfo==null")
callBack?.onError(NOT_A_ROOM_MEMBER, "roomInfo==null")
mMicListJob.start(true)
return
}
Expand All @@ -201,13 +203,13 @@ internal class QAudienceMicHandlerImpl(private val micLinkContext: MicLinkContex
).toJsonString(),
currentRoomInfo!!.chatID, false
)
micLinkContext.mQRtcLiveRoom.joinRtc(token.rtc_token, JsonUtils.toJson(linker))
cameraParams?.let {
micLinkContext.mQRtcLiveRoom.enableCamera(it)
}
microphoneParams?.let {
micLinkContext.mQRtcLiveRoom.enableMicrophone(it)
}
micLinkContext.mQRtcLiveRoom.joinRtc(token.rtc_token, JsonUtils.toJson(linker))
// val users = ArrayList<QNMicLinker>()
// context.mRtcLiveRoom.mClient.remoteUsers.forEach {
// if (it.userID != roomInfo?.anchor?.userId) {
Expand Down Expand Up @@ -248,7 +250,7 @@ internal class QAudienceMicHandlerImpl(private val micLinkContext: MicLinkContex
isPositive: Boolean = true, isKick: Boolean = false, kick: UidMsgMode? = null
) {
if (mMeLinker == null) {
callBack?.onError(-1, "user is not on mic")
callBack?.onError(NOT_A_LINKER_MEMBER, "user is not on mic")
return
}
backGround {
Expand Down Expand Up @@ -335,7 +337,7 @@ internal class QAudienceMicHandlerImpl(private val micLinkContext: MicLinkContex

override fun switchCamera(callBack: QLiveCallBack<QCameraFace>?) {
if (mMeLinker == null) {
callBack?.onError(-1, "not in seat")
callBack?.onError(NOT_A_LINKER_MEMBER, "not in seat")
return
}
micLinkContext.mQRtcLiveRoom.switchCamera() { it, msg ->
Expand Down Expand Up @@ -365,14 +367,9 @@ internal class QAudienceMicHandlerImpl(private val micLinkContext: MicLinkContex
backGround {
doWork {
if (micLinkContext.mQRtcLiveRoom.muteLocalCamera(muted)) {
mLinkDateSource.switch(
mMeLinker!!, false, !muted
)
mLinkDateSource.switch(mMeLinker!!, false, !muted)
RtmManager.rtmClient.sendChannelCMDMsg(
RtmTextMsg<MuteMode>(
liveroom_miclinker_camera_mute,
mode
).toJsonString(),
RtmTextMsg<MuteMode>(liveroom_miclinker_camera_mute, mode).toJsonString(),
currentRoomInfo!!.chatID, true
)
mMeLinker?.isOpenCamera = !muted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ internal class QPKServiceImpl : QPKService, BaseService() {
callBack: QLiveCallBack<QPKSession>?
) {
if (currentRoomInfo == null) {
callBack?.onError(0, " roomInfo==null")
callBack?.onError(QLiveErrorCode.NOT_A_ROOM_MEMBER, " roomInfo==null")
return
}
backGround {
Expand Down Expand Up @@ -564,7 +564,7 @@ internal class QPKServiceImpl : QPKService, BaseService() {

override fun stop(callBack: QLiveCallBack<Void>?) {
if (currentRoomInfo == null || mPKSession?.status != PK_STATUS_OK) {
callBack?.onError(0, " roomInfo==null")
callBack?.onError(QLiveErrorCode.NOT_A_ROOM_MEMBER, " roomInfo==null")
return
}
backGround {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
import com.qlive.sdk.QLive
import com.qlive.core.QLiveErrorCode
import com.qlive.core.QLiveErrorCode.CANCELED_JOIN
import com.qlive.uikit.component.FuncCPTBeautyDialogShower
import com.qlive.uikit.component.FuncCPTPlayerFloatingHandler
import com.qlive.uikit.component.OnKeyDownMonitor
Expand All @@ -54,7 +56,10 @@ class RoomPlayerActivity : BaseFrameActivity() {
extSetter: StartRoomActivityExtSetter?,
callBack: QLiveCallBack<QLiveRoomInfo>?
) {

if(QLive.getLoginUser()==null){
callBack?.onError(QLiveErrorCode.NOT_LOGGED_IN,"QLive.getLoginUser()==null")
return
}
val goRoom = {
startCallBack = callBack
val i = Intent(context, RoomPlayerActivity::class.java)
Expand Down Expand Up @@ -355,7 +360,7 @@ class RoomPlayerActivity : BaseFrameActivity() {
}
FuncCPTPlayerFloatingHandler.currentFloatingPlayerView?.activityRef?.clear()
mRoomClient = null
startCallBack?.onError(-1, "cancel the join room")
startCallBack?.onError(CANCELED_JOIN, "cancel the join room")
startCallBack = null
}

Expand Down
Loading

0 comments on commit 73db014

Please sign in to comment.