diff --git a/ClientDemo/MainWindow.xaml.cs b/ClientDemo/MainWindow.xaml.cs index 1b8cd87..3d9fa9e 100644 --- a/ClientDemo/MainWindow.xaml.cs +++ b/ClientDemo/MainWindow.xaml.cs @@ -66,9 +66,9 @@ namespace ClientDemo public void StopVideo() { lTRTCCloud.stopRemoteView("53245345", TRTCVideoStreamType.TRTCVideoStreamTypeBig); - RemoveCustomVideoView(main, "666", TRTCVideoStreamType.TRTCVideoStreamTypeBig, false); + RemoveCustomVideoView(main, "53245345", TRTCVideoStreamType.TRTCVideoStreamTypeBig, false); lTRTCCloud.stopRemoteView("53245345", TRTCVideoStreamType.TRTCVideoStreamTypeSub); - RemoveCustomVideoView(sub, "666", TRTCVideoStreamType.TRTCVideoStreamTypeSub, false); + RemoveCustomVideoView(sub, "53245345", TRTCVideoStreamType.TRTCVideoStreamTypeSub, false); } private static void RemoveCustomVideoView(Panel parent, string userId, TRTCVideoStreamType streamType, bool local = false) { diff --git a/JianGongYun/TRTC/LiveClassroom.cs b/JianGongYun/TRTC/LiveClassroom.cs index 78d00f8..dbbafec 100644 --- a/JianGongYun/TRTC/LiveClassroom.cs +++ b/JianGongYun/TRTC/LiveClassroom.cs @@ -28,8 +28,10 @@ namespace JianGongYun.TRTC /// public static class LiveClassroom { - const uint SDKAppID = 1400472092; - const string SDKAppKEY = "75907eef24093acc1d2cc20ed1eb95c50cd6728c8f5e0d98b17c5180824eee78"; + const uint SDKAppID = 1400463444; + const string SDKAppKEY = "6ee2586282eb8ab5bff3f917b44500c4ffd9bbd3d820258b1fa8cdd470cfd1ee"; + const uint LIVEAppID = 1252883401; + const uint LIVEBizid = 126866; /// /// TRTC实例 /// @@ -90,7 +92,9 @@ namespace JianGongYun.TRTC userSig = GenTestUserSig(CurrentClassroomEntity.TeacherId), roomId = 0,//使用strRoomId strRoomId = CurrentClassroomEntity.TeacherId, - role = TRTCRoleType.TRTCRoleAnchor + role = TRTCRoleType.TRTCRoleAnchor, + streamId = CurrentClassroomEntity.TeacherId,//旁路CDN流名字为教师id + userDefineRecordId= CurrentClassroomEntity.TeacherId//指定id录制教师 }; lTRTCCloud.enterRoom(ref roomPars, TRTCAppScene.TRTCAppSceneLIVE);//创建房间 @@ -292,6 +296,33 @@ namespace JianGongYun.TRTC lTRTCCloud.selectScreenCaptureTarget(ref current, ref rect, ref property); } + //开启音频后调用 + public static void StartMUX(bool stop = false) + { + if (stop) + { + lTRTCCloud.setMixTranscodingConfig(null); + return; + } + var resolution = settingWindowViewModel.SubEncParams.videoResolution.ToString().Split('_');//屏幕分辨率,本地储存分辨率以屏幕分享分辨率为基准 + lTRTCCloud.setMixTranscodingConfig(new TRTCTranscodingConfig //设置混流 + { + mode = TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Template_ScreenSharing, + appId = LIVEAppID, + bizId = LIVEBizid, + videoWidth = uint.Parse(resolution[1]), + videoHeight = uint.Parse(resolution[2]), + videoBitrate = settingWindowViewModel.SubEncParams.videoBitrate, + videoFramerate = settingWindowViewModel.SubEncParams.videoFps, + videoGOP = 3, + backgroundColor = 0x202020, + audioSampleRate = 48000, + audioBitrate = 128, + audioChannels = 2 + + }); + } + /// /// 启动麦克风 /// @@ -302,6 +333,8 @@ namespace JianGongYun.TRTC liveWinMode.MicRunning = true; lTRTCCloud.startLocalAudio(settingWindowViewModel.LiveAudioLevel); StartRecordAudio(); + + StartMUX(); } } @@ -553,6 +586,7 @@ namespace JianGongYun.TRTC prc.WaitForExit(); CurrentLiveWindow.Dispatcher.Invoke(new Action(() => { + CurrentLiveWindow.Close(); NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel() { Title = "提醒", diff --git a/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs b/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs index 86c8702..bda8fe4 100644 --- a/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs +++ b/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs @@ -798,7 +798,7 @@ namespace JianGongYun.TRTC.ViewModels { var videoResolution = TRTCVideoResolution.TRTCVideoResolution_1920_1080; uint videoBitrate = 2000; - switch (LiveMainLevel) + switch (LiveSubLevel) { case LiveLevelEnum.Low: videoResolution = TRTCVideoResolution.TRTCVideoResolution_960_540; diff --git a/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs b/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs index 7e1cb26..0134eb5 100644 --- a/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs +++ b/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs @@ -168,6 +168,9 @@ namespace JianGongYun.TRTC.Windows LiveClassroom.StopMic(); LiveClassroom.StopVideoMain(AfterLiveViewWrap); LiveClassroom.StopVideoSub(AfterLiveSubViewWrap); + + this.Hide(); + LiveClassroom.CallerWindow.Show();//还原调用者窗口 } }