From 0f7792cb533c99fa4a77b6550b433b50265dd57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BC=BA?= Date: Mon, 30 Sep 2024 14:41:35 +0800 Subject: [PATCH 1/6] for change --- .../APIExample/entry/oh-package-lock.json5 | 8 ++-- .../ets/pages/advance/ChannelEncryption.ets | 6 +-- .../ets/pages/advance/CustomVideoSource.ets | 10 ++--- .../ets/pages/advance/HostCrossChannel.ets | 12 +++--- .../ets/pages/advance/JoinMultiChannel.ets | 6 +-- .../main/ets/pages/advance/LiveStreaming.ets | 4 +- .../pages/advance/LocalVideoTranscoding.ets | 41 ++++++++++++++----- .../ets/pages/advance/MediaMetadataWrap.ets | 4 +- .../main/ets/pages/advance/MediaRecorder.ets | 4 +- .../ets/pages/advance/OriginVideoDataWrap.ets | 4 +- .../main/ets/pages/advance/PreCallTest.ets | 2 +- .../main/ets/pages/advance/RTMPStreaming.ets | 29 +++++++------ .../main/ets/pages/advance/ScreenSharing.ets | 4 +- .../main/ets/pages/basic/JoinVideoChannel.ets | 4 +- .../ets/pages/basic/JoinVideoChannelToken.ets | 4 +- 15 files changed, 83 insertions(+), 59 deletions(-) diff --git a/HarmonyOS_NEXT/APIExample/entry/oh-package-lock.json5 b/HarmonyOS_NEXT/APIExample/entry/oh-package-lock.json5 index 71a5ea407..60fc2b12c 100644 --- a/HarmonyOS_NEXT/APIExample/entry/oh-package-lock.json5 +++ b/HarmonyOS_NEXT/APIExample/entry/oh-package-lock.json5 @@ -6,12 +6,12 @@ "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { "AgoraRtcSdk@libs/AgoraRtcSdk.har": "AgoraRtcSdk@libs/AgoraRtcSdk.har", - "libagora_rtc_sdk.so@../oh_modules/.ohpm/AgoraRtcSdk@gnhkbsqhvur0p1kaytsefmbpezi=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk": "libagora_rtc_sdk.so@../oh_modules/.ohpm/AgoraRtcSdk@gnhkbsqhvur0p1kaytsefmbpezi=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk", + "libagora_rtc_sdk.so@../oh_modules/.ohpm/AgoraRtcSdk@psqmdffzbvli66vvuhpgemb+uuiby9okskr7kzozry4=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk": "libagora_rtc_sdk.so@../oh_modules/.ohpm/AgoraRtcSdk@psqmdffzbvli66vvuhpgemb+uuiby9okskr7kzozry4=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk", "librawdataprocessing.so@src/main/cpp/types/librawdataprocessing": "librawdataprocessing.so@src/main/cpp/types/librawdataprocessing" }, "packages": { "AgoraRtcSdk@libs/AgoraRtcSdk.har": { - "name": "agora_rtc_sdk", + "name": "AgoraRtcSdk", "version": "v4.3.0-beta.1", "resolved": "libs/AgoraRtcSdk.har", "registryType": "local", @@ -19,10 +19,10 @@ "libagora_rtc_sdk.so": "file:./src/main/cpp/types/libagora_rtc_sdk" } }, - "libagora_rtc_sdk.so@../oh_modules/.ohpm/AgoraRtcSdk@gnhkbsqhvur0p1kaytsefmbpezi=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk": { + "libagora_rtc_sdk.so@../oh_modules/.ohpm/AgoraRtcSdk@psqmdffzbvli66vvuhpgemb+uuiby9okskr7kzozry4=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk": { "name": "libagora_rtc_sdk.so", "version": "0.0.0", - "resolved": "../oh_modules/.ohpm/AgoraRtcSdk@gnhkbsqhvur0p1kaytsefmbpezi=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk", + "resolved": "../oh_modules/.ohpm/AgoraRtcSdk@psqmdffzbvli66vvuhpgemb+uuiby9okskr7kzozry4=/oh_modules/AgoraRtcSdk/src/main/cpp/types/libagora_rtc_sdk", "registryType": "local" }, "librawdataprocessing.so@src/main/cpp/types/librawdataprocessing": { diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets index e44fd4bd7..b1cfde0c8 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets @@ -125,7 +125,7 @@ struct ChannelEncryption { if (this.localUid != -1) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -139,7 +139,7 @@ struct ChannelEncryption { if (this.remoteUid != -1) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); @@ -219,7 +219,7 @@ struct ChannelEncryption { config.encryptionMode = this.encryptionModeOptions[this.encryptionModeSelectIndex] config.encryptionKey = this.encryptionKey let base64 = new util.Base64Helper(); - config.encryptionKdfSalt = base64.decodeSync("NiIeJ08AbtcQVjvV+oOEvF/4Dz5dy1CIwa805C8J2w0=", util.Type.BASIC) + config.encryptionKdfSalt = base64.decodeSync("NiIeJ08AbtcQVjvV+oOEvF/4Dz5dy1CIwa805C8J2w0=", util.Type.BASIC).buffer as ArrayBuffer this.rtcEngine?.enableEncryption(true, config) let mediaOption: ChannelMediaOptions = new ChannelMediaOptions(); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets index 27de9dd2c..723408c70 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets @@ -122,11 +122,11 @@ struct CustomVideoSource { let frameBuffer: Uint8Array = buffer.slice(readStart, readStart + frame_size) readStart += frame_size let frame: VideoFrame = new VideoFrame( - VideoBufferType.VIDEO_BUFFER_RAW_DATA, + VideoBufferType.RAW_DATA, VideoPixelFormat.VIDEO_PIXEL_I420); frame.buffer = frameBuffer.buffer as ArrayBuffer; frame.rotation = 0; - frame.stride = width; + frame.yStride = width; frame.height = height; frame.timestamp = 0; let ret = this.rtcEngine?.pushExternalVideoFrameById(frame, this.customVideoTrack) @@ -159,7 +159,7 @@ struct CustomVideoSource { if (this.localUid != 0) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -167,7 +167,7 @@ struct CustomVideoSource { localCanvas.renderMode = VideoCanvas.RENDER_MODE_HIDDEN; localCanvas.mirrorMode = 0; // TODO set source type - // localCanvas.sourceType = Constants.VideoSourceType.VIDEO_SOURCE_CUSTOM + localCanvas.sourceType = Constants.VideoSourceType.CUSTOM this.rtcEngine?.setupLocalVideo(localCanvas); }).width('50%') } @@ -175,7 +175,7 @@ struct CustomVideoSource { if (this.remoteUid != 0) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets index 66c9e3ef4..4b7d6e25f 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets @@ -115,7 +115,7 @@ struct HostCrossChannel { if (this.localUid != 0) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -129,7 +129,7 @@ struct HostCrossChannel { if (this.remoteUid != 0) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); @@ -186,12 +186,12 @@ struct HostCrossChannel { let config = new ChannelMediaRelayConfiguration() config.srcInfo.channelName = this.channelName config.srcInfo.uid = this.localUid - config.srcInfo.token = await TokenUtils.genRtcToken(this.channelName, '') - config.destInfos[this.relayChannelName] = { + config.srcInfo.token = "" + config.destInfos.set(this.relayChannelName, { channelName: this.relayChannelName, uid: 999, - token: await TokenUtils.genRtcToken(this.relayChannelName, '999') - } + token: "" + }) this.rtcEngine?.startOrUpdateChannelMediaRelay(config) } }) diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets index 9364d8ce0..37915eafa 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets @@ -108,7 +108,7 @@ struct JoinMultiChannel { if (this.mainLocalUid != 0) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -122,7 +122,7 @@ struct JoinMultiChannel { if (this.mainRemoteUid != 0) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); @@ -141,7 +141,7 @@ struct JoinMultiChannel { if (this.exRemoteUid != 0) { XComponent({ id: 'preview_remote_ex', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets index ce7d7ea9f..a2781edf9 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets @@ -166,7 +166,7 @@ struct LiveStreaming { if (this.localUid != -1) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -180,7 +180,7 @@ struct LiveStreaming { if (this.remoteUid != -1) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets index 464a11043..7309dd6a6 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets @@ -19,6 +19,10 @@ import { common } from '@kit.AbilityKit'; import { GlobalInfo } from '../Data'; import { TokenUtils } from '../../util/TokenUtils'; import { LengthMetrics } from '@kit.ArkUI'; +import { TranscodingVideoStream } from 'AgoraRtcSdk'; +import { JSON } from '@kit.ArkTS'; +import { camera } from '@kit.CameraKit'; +import { VideoDimensions } from 'AgoraRtcSdk'; const TAG: string = 'LocalVideoTranscoding' @@ -65,6 +69,15 @@ struct LocalVideoTranscoding { Logger.info(TAG, "mEventHandler.onError: " + err + " message " + message); ShowToast.longToast("onError " + err + " : " + message) } + config.mEventHandler.onLocalVideoTranscoderError = (stream:TranscodingVideoStream, error:Constants.VideoTranscoderError) => { + Logger.info(TAG, "mEventHandler.onLocalVideoTranscoderError stream "+JSON.stringify(stream) + " error: "+error); + ShowToast.longToast("onLocalVideoTranscoderError " + error ) + } + + config.mEventHandler.onTranscodingUpdated = () => { + Logger.info(TAG, "mEventHandler.onTranscodingUpdated"); + } + config.mContext = context; Logger.info(TAG, "in thread create engine begin: "); this.rtcEngine = RtcEngine.create(config); @@ -119,12 +132,12 @@ struct LocalVideoTranscoding { if (this.localUid != -1) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); localCanvas.uid = this.localUid; - localCanvas.renderMode = VideoCanvas.RENDER_MODE_HIDDEN; + localCanvas.renderMode = VideoCanvas.RENDER_MODE_FIT; localCanvas.mirrorMode = 0; localCanvas.sourceType = Constants.VideoSourceType.TRANSCODED this.rtcEngine?.setupLocalVideo(localCanvas); @@ -134,13 +147,14 @@ struct LocalVideoTranscoding { if (this.remoteUid != -1) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); localCanvas.uid = this.remoteUid; localCanvas.renderMode = VideoCanvas.RENDER_MODE_HIDDEN; localCanvas.mirrorMode = 0; + localCanvas.sourceType = Constants.VideoSourceType.TRANSCODED; this.rtcEngine?.setupRemoteVideo(localCanvas); }).width('30%').height('30%').margin({ top: 12, right: 12 }) } @@ -176,8 +190,8 @@ struct LocalVideoTranscoding { } - let width = 720; - let height = 1280; + let width = 960; + let height = 540; let screenConfig = new ScreenCaptureParameters() this.rtcEngine?.startScreenCapture(screenConfig) @@ -187,16 +201,21 @@ struct LocalVideoTranscoding { let config = new LocalTranscoderConfiguration() config.transcodingVideoStreams = new Array(2) + config.videoOutputConfiguration.dimensions = new VideoDimensions(width,height) + config.transcodingVideoStreams[0] = new TranscodingVideoStream(); config.transcodingVideoStreams[0].sourceType = Constants.VideoSourceType.SCREEN_PRIMARY - config.transcodingVideoStreams[0].width = width + config.transcodingVideoStreams[0].width = width/2 config.transcodingVideoStreams[0].height = height + config.transcodingVideoStreams[0].x = 0 + config.transcodingVideoStreams[0].y = 0 config.transcodingVideoStreams[0].zOrder = 1 + config.transcodingVideoStreams[1] = new TranscodingVideoStream() config.transcodingVideoStreams[1].sourceType = Constants.VideoSourceType.CAMERA_PRIMARY - config.transcodingVideoStreams[1].width = width / 2 - config.transcodingVideoStreams[1].height = height / 2 - config.transcodingVideoStreams[1].x = 0 - config.transcodingVideoStreams[1].y = height / 2 + config.transcodingVideoStreams[1].width = width/2 + config.transcodingVideoStreams[1].height = height + config.transcodingVideoStreams[1].x = width/2 + config.transcodingVideoStreams[1].y = 0 config.transcodingVideoStreams[1].zOrder = 2 config.transcodingVideoStreams[1].mirror = true @@ -213,7 +232,7 @@ struct LocalVideoTranscoding { mediaOption.channelProfile = Constants.ChannelProfile.LIVE_BROADCASTING; mediaOption.clientRoleType = Constants.ClientRole.BROADCASTER; - let token = await TokenUtils.genRtcToken(this.channelName, "") + let token = "" let ret = this.rtcEngine?.joinChannelWithOptions(token, this.channelName, 0, mediaOption) if (ret != Constants.ErrorCode.ERR_OK) { ShowToast.longToast("joinChannelWithOptions error " + ret + " : " + diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets index ebbc082d7..81eb83e30 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets @@ -102,7 +102,7 @@ struct MediaMetadataWrap { if (this.localUid != 0) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -116,7 +116,7 @@ struct MediaMetadataWrap { if (this.remoteUid != 0) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets index 82962ba01..c884cbb39 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets @@ -118,7 +118,7 @@ struct MediaRecorder { Stack() { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -191,7 +191,7 @@ struct MediaRecorder { Stack() { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets index 88852ef9f..8ba298074 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets @@ -100,7 +100,7 @@ struct OriginVideoDataWrap { if (this.localUid != 0) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -114,7 +114,7 @@ struct OriginVideoDataWrap { if (this.remoteUid != 0) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets index d72c38d2c..46d6d0cff 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets @@ -204,7 +204,7 @@ struct PlayAudioFiles { }) XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets index ba4f67ac4..38d2d818b 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets @@ -42,14 +42,16 @@ struct RTMPStreaming { Logger.info(TAG, "mEventHandler.onUserJoined: " + uid + " , " + collapse); if (this.remoteUid == -1) { this.remoteUid = uid - this.transcodingParameters.transcodingUsers[uid] = { - uid: uid, - x: 0, - y: this.transcodingParameters.height / 2, - width: this.transcodingParameters.width, - height: this.transcodingParameters.height / 2, - zOrder: 1 - } + let user = new TranscodingUser(); + user.uid = uid; + user.x = 0; + user.y = this.transcodingParameters.height / 2; + user.width = this.transcodingParameters.width; + user.height = this.transcodingParameters.height / 2; + user.zOrder = 1; + user.alpha = 1.0 + user.audioChannel = 2; + this.transcodingParameters.transcodingUsers.set(uid,user) } }; config.mEventHandler.onUserOffline = (uid: number, reason: number) => { @@ -62,14 +64,17 @@ struct RTMPStreaming { config.mEventHandler.onJoinChannelSuccess = (cid: string, uid: number, elapsed: number) => { Logger.info(TAG, "mEventHandler.onJoinChannelSuccess: " + uid); this.transcodingParameters.transcodingUsers = new Map(); - this.transcodingParameters.transcodingUsers[uid] = { + let localUser:TranscodingUser = { uid: uid, x: 0, y: 0, width: this.transcodingParameters.width, height: this.transcodingParameters.height / 2, - zOrder: 1 + zOrder: 1, + alpha:1.0, + audioChannel:2, } + this.transcodingParameters.transcodingUsers.set(uid,localUser) this.isJoin = true this.localUid = uid } @@ -130,7 +135,7 @@ struct RTMPStreaming { if (this.localUid != -1) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -144,7 +149,7 @@ struct RTMPStreaming { if (this.remoteUid != -1) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets index 5798be078..8134a5944 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets @@ -118,7 +118,7 @@ struct ScreenSharing { if (this.localUid != -1) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -133,7 +133,7 @@ struct ScreenSharing { if (this.remoteUid != -1) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets index e3c252ef0..56ea46e4a 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets @@ -93,7 +93,7 @@ struct JoinVideoChannel { if (this.localUid != 0) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -107,7 +107,7 @@ struct JoinVideoChannel { if (this.remoteUid != 0) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets index 908a15e4e..83da234b2 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets @@ -119,7 +119,7 @@ struct JoinVideoChannelToken { if (this.localUid != 0) { XComponent({ id: 'preview_local', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_local"); @@ -133,7 +133,7 @@ struct JoinVideoChannelToken { if (this.remoteUid != 0) { XComponent({ id: 'preview_remote', - type: 'surface', + type: XComponentType.SURFACE, libraryname: Constants.AGORA_LIB_NAME, }).onLoad(() => { let localCanvas = new VideoCanvas("preview_remote"); From cb0183fcd746834b4163995bcbca76996bb7cb65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BC=BA?= Date: Wed, 16 Oct 2024 12:31:55 +0800 Subject: [PATCH 2/6] change package name to @shengwang/rtc-full --- HarmonyOS_NEXT/APIExample/entry/oh-package.json5 | 2 +- .../APIExample/entry/src/main/cpp/CMakeLists.txt | 2 +- .../entry/src/main/ets/common/KeyCenter.ets | 4 ++-- .../entry/src/main/ets/model/DataType.ets | 2 +- .../APIExample/entry/src/main/ets/pages/Data.ets | 2 +- .../entry/src/main/ets/pages/Settings.ets | 2 +- .../main/ets/pages/advance/ChannelEncryption.ets | 2 +- .../ets/pages/advance/CustomAudioRenderWrap.ets | 2 +- .../main/ets/pages/advance/CustomAudioSource.ets | 2 +- .../main/ets/pages/advance/CustomVideoSource.ets | 14 +++++--------- .../main/ets/pages/advance/HostCrossChannel.ets | 2 +- .../main/ets/pages/advance/JoinMultiChannel.ets | 2 +- .../src/main/ets/pages/advance/LiveStreaming.ets | 2 +- .../ets/pages/advance/LocalVideoTranscoding.ets | 10 +++++----- .../main/ets/pages/advance/MediaMetadataWrap.ets | 2 +- .../src/main/ets/pages/advance/MediaRecorder.ets | 2 +- .../main/ets/pages/advance/OriginAudioDataWrap.ets | 2 +- .../main/ets/pages/advance/OriginVideoDataWrap.ets | 2 +- .../src/main/ets/pages/advance/PlayAudioFiles.ets | 2 +- .../src/main/ets/pages/advance/PreCallTest.ets | 2 +- .../src/main/ets/pages/advance/RTMPStreaming.ets | 2 +- .../src/main/ets/pages/advance/ScreenSharing.ets | 2 +- .../src/main/ets/pages/basic/JoinAudioChannel.ets | 2 +- .../src/main/ets/pages/basic/JoinVideoChannel.ets | 2 +- .../main/ets/pages/basic/JoinVideoChannelToken.ets | 2 +- .../entry/src/main/ets/util/AudioConfigContant.ets | 2 +- 26 files changed, 35 insertions(+), 39 deletions(-) diff --git a/HarmonyOS_NEXT/APIExample/entry/oh-package.json5 b/HarmonyOS_NEXT/APIExample/entry/oh-package.json5 index cc2d344da..24e606565 100644 --- a/HarmonyOS_NEXT/APIExample/entry/oh-package.json5 +++ b/HarmonyOS_NEXT/APIExample/entry/oh-package.json5 @@ -6,7 +6,7 @@ "author": "", "license": "", "dependencies": { - "AgoraRtcSdk": "file:./libs/AgoraRtcSdk.har", + "@shengwang/rtc-full": "file:./libs/AgoraRtcSdk.har", "librawdataprocessing.so": "file:./src/main/cpp/types/librawdataprocessing" } } diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/cpp/CMakeLists.txt b/HarmonyOS_NEXT/APIExample/entry/src/main/cpp/CMakeLists.txt index ad18be409..7ae131518 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/cpp/CMakeLists.txt +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/cpp/CMakeLists.txt @@ -11,7 +11,7 @@ endif() include_directories(${ROOT_PATH} ${ROOT_PATH}/include) -set(AGORA_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/AgoraRtcSdk/libs) +set(AGORA_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@shengwang/rtc-full/libs) add_library(agora_rtc_sdk SHARED IMPORTED) set_target_properties(agora_rtc_sdk PROPERTIES IMPORTED_LOCATION ${AGORA_LIB_PATH}/${CMAKE_OHOS_ARCH_ABI}/libagora_rtc_sdk.so) diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets index 8cd76ba30..f8d675bba 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets @@ -2,10 +2,10 @@ // Agora APP ID. // 声网APP ID。 -export const AppID: string = YOUR APP ID +export const AppID: string = "aab8b8f5a8cd4469a63042fcfafe7063" // Agora APP Certificate. If the project does not have certificates enabled, leave this field blank. // PS:It is unsafe to place the App Certificate on the client side, it is recommended to place it on the server side to ensure that the App Certificate is not leaked. // 声网APP证书。如果项目没有开启证书鉴权,这个字段留空。 // 注意:App证书放在客户端不安全,推荐放在服务端以确保 App 证书不会泄露。 -export const AppCertificate: string = YOUR APP CERTIFICATE \ No newline at end of file +export const AppCertificate: string = "" \ No newline at end of file diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/model/DataType.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/model/DataType.ets index 2380a9ab0..6aa3d91e5 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/model/DataType.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/model/DataType.ets @@ -1,4 +1,4 @@ -import { OrientationMode, VideoDimensions } from 'AgoraRtcSdk' +import { OrientationMode, VideoDimensions } from '@shengwang/rtc-full' export interface ExampleCategory{ title: Resource, diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Data.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Data.ets index 9a9dafb57..682eec7a3 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Data.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Data.ets @@ -1,4 +1,4 @@ -import { OrientationMode, VideoDimensions } from 'AgoraRtcSdk' +import { OrientationMode, VideoDimensions } from '@shengwang/rtc-full' import { ExampleCategory, ExampleItem, SettingsInfo } from '../model/DataType' export const BASIC_ITEMS: ExampleItem[] = diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Settings.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Settings.ets index 0115351e1..e6d6755df 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Settings.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/Settings.ets @@ -1,4 +1,4 @@ -import { OrientationMode, RtcEngine, VideoDimensions } from 'AgoraRtcSdk' +import { OrientationMode, RtcEngine, VideoDimensions } from '@shengwang/rtc-full' import { TitleBar } from '../common/TitleBar' import { CommonItemSelect } from '../common/Widgets' import { GlobalInfo } from './Data' diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets index b1cfde0c8..f85bb4915 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ChannelEncryption.ets @@ -4,7 +4,7 @@ import { EncryptionMode, RtcEngine, RtcEngineConfig, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioRenderWrap.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioRenderWrap.ets index 1826ae278..0db1755d7 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioRenderWrap.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioRenderWrap.ets @@ -3,7 +3,7 @@ import { Constants, RtcEngine, RtcEngineConfig -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioSource.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioSource.ets index 93d333552..27f9c16ae 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioSource.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomAudioSource.ets @@ -1,5 +1,5 @@ import { AudioTrackConfig, ChannelMediaOptions, Constants, RtcEngine, RtcEngineConfig, - VideoEncoderConfiguration } from 'AgoraRtcSdk'; + VideoEncoderConfiguration } from '@shengwang/rtc-full'; import { common } from '@kit.AbilityKit'; import { AppID } from '../../common/KeyCenter'; import Logger from '../../util/Logger'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets index 723408c70..1ab4a38a8 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/CustomVideoSource.ets @@ -9,7 +9,7 @@ import { VideoEncoderConfiguration, VideoFrame, VideoPixelFormat -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; @@ -27,7 +27,6 @@ struct CustomVideoSource { private rtcEngine: RtcEngineEx | undefined = undefined; private pushingVideoFrame = false private intervalVideoNum = -1; - private customVideoTrack = -1; @State message: string = 'Hello World'; @State channelName: string = '' @State isJoin: boolean = false @@ -77,7 +76,7 @@ struct CustomVideoSource { this.rtcEngine.enableVideo() - this.customVideoTrack = this.rtcEngine.createCustomVideoTrack() + this.rtcEngine.setExternalVideoSource(true,false,Constants.ExternalVideoSourceType.VIDEO_FRAME); } aboutToDisappear(): void { @@ -87,8 +86,6 @@ struct CustomVideoSource { this.rtcEngine.leaveChannel(); } this.stopPushVideo() - this.rtcEngine.destroyCustomVideoTrack(this.customVideoTrack) - this.customVideoTrack = -1 Logger.info(TAG, "destroy begin") RtcEngine.destroy().then(() => { Logger.info(TAG, "destroy done") @@ -129,8 +126,8 @@ struct CustomVideoSource { frame.yStride = width; frame.height = height; frame.timestamp = 0; - let ret = this.rtcEngine?.pushExternalVideoFrameById(frame, this.customVideoTrack) - if (ret != 0) { + let ret = this.rtcEngine?.pushExternalVideoFrame(frame) + if (!ret) { Logger.error(TAG, "pushExternalVideoFrameEx failed: " + ret) } }, frame_interval_ms) @@ -165,7 +162,7 @@ struct CustomVideoSource { let localCanvas = new VideoCanvas("preview_local"); localCanvas.uid = this.localUid; localCanvas.renderMode = VideoCanvas.RENDER_MODE_HIDDEN; - localCanvas.mirrorMode = 0; + localCanvas.mirrorMode = VideoCanvas.VIDEO_MIRROR_MODE_DISABLED; // TODO set source type localCanvas.sourceType = Constants.VideoSourceType.CUSTOM this.rtcEngine?.setupLocalVideo(localCanvas); @@ -232,7 +229,6 @@ struct CustomVideoSource { } let mediaOption: ChannelMediaOptions = new ChannelMediaOptions(); mediaOption.publishCustomVideoTrack = true - mediaOption.customVideoTrackId = this.customVideoTrack mediaOption.publishMicrophoneTrack = true; mediaOption.autoSubscribeVideo = true; mediaOption.autoSubscribeAudio = true; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets index 4b7d6e25f..ef669626d 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/HostCrossChannel.ets @@ -6,7 +6,7 @@ import { RtcEngineConfig, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets index 37915eafa..38038f1e9 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/JoinMultiChannel.ets @@ -8,7 +8,7 @@ import { RtcEngineEx, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import { common } from '@kit.AbilityKit'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets index a2781edf9..b1b0f65b3 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LiveStreaming.ets @@ -6,7 +6,7 @@ import { RtcEngineConfig, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets index 7309dd6a6..7f8831132 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets @@ -9,7 +9,7 @@ import { VideoCanvas, VideoEncoderConfiguration, ScreenCaptureParameters -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; @@ -19,10 +19,10 @@ import { common } from '@kit.AbilityKit'; import { GlobalInfo } from '../Data'; import { TokenUtils } from '../../util/TokenUtils'; import { LengthMetrics } from '@kit.ArkUI'; -import { TranscodingVideoStream } from 'AgoraRtcSdk'; +import { TranscodingVideoStream } from '@shengwang/rtc-full'; import { JSON } from '@kit.ArkTS'; import { camera } from '@kit.CameraKit'; -import { VideoDimensions } from 'AgoraRtcSdk'; +import { VideoDimensions } from '@shengwang/rtc-full'; const TAG: string = 'LocalVideoTranscoding' @@ -190,8 +190,8 @@ struct LocalVideoTranscoding { } - let width = 960; - let height = 540; + let width = 540; + let height = 960; let screenConfig = new ScreenCaptureParameters() this.rtcEngine?.startScreenCapture(screenConfig) diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets index 81eb83e30..30992e746 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaMetadataWrap.ets @@ -4,7 +4,7 @@ import { RtcEngineConfig, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets index c884cbb39..57b92c7b3 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/MediaRecorder.ets @@ -10,7 +10,7 @@ import { RtcEngineConfig, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginAudioDataWrap.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginAudioDataWrap.ets index 8cb6e6163..2b37421bc 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginAudioDataWrap.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginAudioDataWrap.ets @@ -3,7 +3,7 @@ import { Constants, RtcEngine, RtcEngineConfig -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets index 8ba298074..a85797bd0 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/OriginVideoDataWrap.ets @@ -4,7 +4,7 @@ import { RtcEngineConfig, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PlayAudioFiles.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PlayAudioFiles.ets index 2c99aa24f..95fe67c07 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PlayAudioFiles.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PlayAudioFiles.ets @@ -1,4 +1,4 @@ -import { ChannelMediaOptions, Constants, RtcEngine, RtcEngineConfig } from 'AgoraRtcSdk'; +import { ChannelMediaOptions, Constants, RtcEngine, RtcEngineConfig } from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets index 46d6d0cff..5813fc909 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/PreCallTest.ets @@ -5,7 +5,7 @@ import { RtcEngine, RtcEngineConfig, VideoCanvas -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { AppID } from '../../common/KeyCenter'; import Logger from '../../util/Logger'; import { common } from '@kit.AbilityKit'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets index 38d2d818b..295313fd5 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/RTMPStreaming.ets @@ -6,7 +6,7 @@ import { TranscodingUser, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets index 8134a5944..8414ebc88 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/ScreenSharing.ets @@ -7,7 +7,7 @@ import { ScreenCaptureParameters, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinAudioChannel.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinAudioChannel.ets index e8a70bbd9..02cdb295f 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinAudioChannel.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinAudioChannel.ets @@ -1,4 +1,4 @@ -import { ChannelMediaOptions, Constants, RtcEngine, RtcEngineEx, RtcEngineConfig, AudioVolumeInfo } from 'AgoraRtcSdk'; +import { ChannelMediaOptions, Constants, RtcEngine, RtcEngineEx, RtcEngineConfig, AudioVolumeInfo } from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets index 56ea46e4a..451216568 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannel.ets @@ -1,5 +1,5 @@ import { ChannelMediaOptions, Constants, RtcEngine, RtcEngineConfig, VideoCanvas, - VideoEncoderConfiguration } from 'AgoraRtcSdk'; + VideoEncoderConfiguration } from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets index 83da234b2..0d489e23d 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/basic/JoinVideoChannelToken.ets @@ -5,7 +5,7 @@ import { RtcEngineConfig, VideoCanvas, VideoEncoderConfiguration -} from 'AgoraRtcSdk'; +} from '@shengwang/rtc-full'; import { TitleBar } from '../../common/TitleBar'; import Logger from '../../util/Logger'; import ShowToast from '../../util/ShowToast'; diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/util/AudioConfigContant.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/util/AudioConfigContant.ets index 30116f271..9217c9b0d 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/util/AudioConfigContant.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/util/AudioConfigContant.ets @@ -1,4 +1,4 @@ -import { Constants } from 'AgoraRtcSdk'; +import { Constants } from '@shengwang/rtc-full'; export class AudioConfigHelper { public static readonly AUDIO_SCENARIO_DEFAULT = 'DEFAULT' From 9272795f7b396d8f00a83f95decc2d6252241b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BC=BA?= Date: Wed, 16 Oct 2024 12:32:17 +0800 Subject: [PATCH 3/6] change compatibleSdkVersion to 12 --- HarmonyOS_NEXT/APIExample/build-profile.json5 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/HarmonyOS_NEXT/APIExample/build-profile.json5 b/HarmonyOS_NEXT/APIExample/build-profile.json5 index 4d540b2b1..54ddd3528 100644 --- a/HarmonyOS_NEXT/APIExample/build-profile.json5 +++ b/HarmonyOS_NEXT/APIExample/build-profile.json5 @@ -1,12 +1,25 @@ { "app": { "signingConfigs": [ + { + "name": "default", + "type": "HarmonyOS", + "material": { + "certpath": "/Users/cq/.ohos/config/default_APIExample_axMKKS64cQDQsQ6bHFnXMUpgiiWWvdAiYIAQRESXFcE=.cer", + "storePassword": "0000001B29F4B597AE24E5DFA695B70A98E876AD80EBAC66A7A107C5B98378DA1F7C3446A142560E622057", + "keyAlias": "debugKey", + "keyPassword": "0000001B636D85EE406DD60B7DFB648047967EF17C9D98A2FA5C207C4F810B2E9CFB715DEAE140F72BD0AE", + "profile": "/Users/cq/.ohos/config/default_APIExample_axMKKS64cQDQsQ6bHFnXMUpgiiWWvdAiYIAQRESXFcE=.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "/Users/cq/.ohos/config/default_APIExample_axMKKS64cQDQsQ6bHFnXMUpgiiWWvdAiYIAQRESXFcE=.p12" + } + } ], "products": [ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "4.1.0(11)", + "compatibleSdkVersion": "5.0.0(12)", "runtimeOS": "HarmonyOS", } ], From 13e4296731ea549b2eadf2ec0b388147e99f136d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BC=BA?= Date: Wed, 16 Oct 2024 12:38:57 +0800 Subject: [PATCH 4/6] fix mistake --- .../pages/advance/LocalVideoTranscoding.ets | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets index 7f8831132..2959ae3cf 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/pages/advance/LocalVideoTranscoding.ets @@ -18,7 +18,7 @@ import PermissionHelper from '../../util/PermissionHelper'; import { common } from '@kit.AbilityKit'; import { GlobalInfo } from '../Data'; import { TokenUtils } from '../../util/TokenUtils'; -import { LengthMetrics } from '@kit.ArkUI'; +import { display,LengthMetrics } from '@kit.ArkUI'; import { TranscodingVideoStream } from '@shengwang/rtc-full'; import { JSON } from '@kit.ArkTS'; import { camera } from '@kit.CameraKit'; @@ -124,7 +124,7 @@ struct LocalVideoTranscoding { build() { Column() { TitleBar({ - title: $r('app.string.item_livestreaming'), + title: $r('app.string.item_localvideotranscoding'), showBack: true }) @@ -138,7 +138,7 @@ struct LocalVideoTranscoding { let localCanvas = new VideoCanvas("preview_local"); localCanvas.uid = this.localUid; localCanvas.renderMode = VideoCanvas.RENDER_MODE_FIT; - localCanvas.mirrorMode = 0; + localCanvas.mirrorMode = VideoCanvas.VIDEO_MIRROR_MODE_DISABLED; localCanvas.sourceType = Constants.VideoSourceType.TRANSCODED this.rtcEngine?.setupLocalVideo(localCanvas); }).width('100%').height('100%') @@ -190,10 +190,11 @@ struct LocalVideoTranscoding { } - let width = 540; - let height = 960; + let width = GlobalInfo.settings.dimensions.height + let height = GlobalInfo.settings.dimensions.width let screenConfig = new ScreenCaptureParameters() + screenConfig.videoParams.dimensions = new VideoDimensions(width,height) this.rtcEngine?.startScreenCapture(screenConfig) let cameraConfig = new CameraCapturerConfiguration() @@ -204,7 +205,7 @@ struct LocalVideoTranscoding { config.videoOutputConfiguration.dimensions = new VideoDimensions(width,height) config.transcodingVideoStreams[0] = new TranscodingVideoStream(); config.transcodingVideoStreams[0].sourceType = Constants.VideoSourceType.SCREEN_PRIMARY - config.transcodingVideoStreams[0].width = width/2 + config.transcodingVideoStreams[0].width = width config.transcodingVideoStreams[0].height = height config.transcodingVideoStreams[0].x = 0 config.transcodingVideoStreams[0].y = 0 @@ -213,9 +214,9 @@ struct LocalVideoTranscoding { config.transcodingVideoStreams[1] = new TranscodingVideoStream() config.transcodingVideoStreams[1].sourceType = Constants.VideoSourceType.CAMERA_PRIMARY config.transcodingVideoStreams[1].width = width/2 - config.transcodingVideoStreams[1].height = height - config.transcodingVideoStreams[1].x = width/2 - config.transcodingVideoStreams[1].y = 0 + config.transcodingVideoStreams[1].height = height/2 + config.transcodingVideoStreams[1].x = 0 + config.transcodingVideoStreams[1].y = height / 2 config.transcodingVideoStreams[1].zOrder = 2 config.transcodingVideoStreams[1].mirror = true From ed8775dccd1f6d14d105cd195b2c6ecdb0dbdfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BC=BA?= Date: Wed, 16 Oct 2024 12:43:00 +0800 Subject: [PATCH 5/6] fix mistake --- HarmonyOS_NEXT/APIExample/build-profile.json5 | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/HarmonyOS_NEXT/APIExample/build-profile.json5 b/HarmonyOS_NEXT/APIExample/build-profile.json5 index 54ddd3528..b2cc02977 100644 --- a/HarmonyOS_NEXT/APIExample/build-profile.json5 +++ b/HarmonyOS_NEXT/APIExample/build-profile.json5 @@ -1,19 +1,6 @@ { "app": { "signingConfigs": [ - { - "name": "default", - "type": "HarmonyOS", - "material": { - "certpath": "/Users/cq/.ohos/config/default_APIExample_axMKKS64cQDQsQ6bHFnXMUpgiiWWvdAiYIAQRESXFcE=.cer", - "storePassword": "0000001B29F4B597AE24E5DFA695B70A98E876AD80EBAC66A7A107C5B98378DA1F7C3446A142560E622057", - "keyAlias": "debugKey", - "keyPassword": "0000001B636D85EE406DD60B7DFB648047967EF17C9D98A2FA5C207C4F810B2E9CFB715DEAE140F72BD0AE", - "profile": "/Users/cq/.ohos/config/default_APIExample_axMKKS64cQDQsQ6bHFnXMUpgiiWWvdAiYIAQRESXFcE=.p7b", - "signAlg": "SHA256withECDSA", - "storeFile": "/Users/cq/.ohos/config/default_APIExample_axMKKS64cQDQsQ6bHFnXMUpgiiWWvdAiYIAQRESXFcE=.p12" - } - } ], "products": [ { From 09f297d3c732ed4739f634ff7f99debb28a23b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BC=BA?= Date: Wed, 16 Oct 2024 13:23:57 +0800 Subject: [PATCH 6/6] fix mistake --- .../APIExample/entry/src/main/ets/common/KeyCenter.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets index f8d675bba..8cd76ba30 100644 --- a/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets +++ b/HarmonyOS_NEXT/APIExample/entry/src/main/ets/common/KeyCenter.ets @@ -2,10 +2,10 @@ // Agora APP ID. // 声网APP ID。 -export const AppID: string = "aab8b8f5a8cd4469a63042fcfafe7063" +export const AppID: string = YOUR APP ID // Agora APP Certificate. If the project does not have certificates enabled, leave this field blank. // PS:It is unsafe to place the App Certificate on the client side, it is recommended to place it on the server side to ensure that the App Certificate is not leaked. // 声网APP证书。如果项目没有开启证书鉴权,这个字段留空。 // 注意:App证书放在客户端不安全,推荐放在服务端以确保 App 证书不会泄露。 -export const AppCertificate: string = "" \ No newline at end of file +export const AppCertificate: string = YOUR APP CERTIFICATE \ No newline at end of file