修改直接启动窗口,添加roomid

This commit is contained in:
wbin 2021-02-09 14:10:38 +08:00
parent 9cd65104b0
commit 86f6b9d69b
5 changed files with 36 additions and 11 deletions

View File

@ -5,6 +5,6 @@
<add key="SDKAppKEY" value="6ee2586282eb8ab5bff3f917b44500c4ffd9bbd3d820258b1fa8cdd470cfd1ee"/>
<add key="LIVEAppID" value="1252883401"/>
<add key="LIVEBizid" value="126866"/>
<add key="RoomId" value =""/>
<add key="RoomId" value ="654657754"/>
</appSettings>
</configuration>

View File

@ -13,6 +13,5 @@ namespace JianGongYun
/// </summary>
public partial class App : Application
{
}
}

View File

@ -100,7 +100,7 @@ namespace JianGongYun.TRTC
strRoomId = CurrentClassroomEntity.TeacherId,
role = TRTCRoleType.TRTCRoleAnchor,
streamId = CurrentClassroomEntity.TeacherId,//旁路CDN流名字为教师id
userDefineRecordId= CurrentClassroomEntity.TeacherId//指定id录制教师
userDefineRecordId = CurrentClassroomEntity.TeacherId//指定id录制教师
};
lTRTCCloud.enterRoom(ref roomPars, TRTCAppScene.TRTCAppSceneLIVE);//创建房间
@ -128,7 +128,7 @@ namespace JianGongYun.TRTC
_RecoderDir = $"{classroomEntity.ClassHead}_{classroomEntity.ClassSubHead}";
callerWindow.Hide();//隐藏调用窗口
callerWindow?.Hide();//隐藏调用窗口
CurrentLiveWindow.Show();
}
@ -493,7 +493,7 @@ namespace JianGongYun.TRTC
}
}
Skip1:
Skip1:
if (liveWinMode.CameraRunning)//摄像头分享中
{
@ -521,7 +521,7 @@ namespace JianGongYun.TRTC
}
}
Skip2:
Skip2:
mats.Enqueue(BackgroundFrame.CvtColor(ColorConversionCodes.BGRA2BGR));
Interlocked.Increment(ref runFps);
@ -712,7 +712,7 @@ namespace JianGongYun.TRTC
{
CurrentLiveWindow = null;
CurrentClassroomEntity = null;
CallerWindow.Show();//还原调用者窗口
lTXDeviceManager.Dispose();
lTXDeviceManager = null;
@ -721,6 +721,13 @@ namespace JianGongYun.TRTC
ITRTCCloud.destroyTRTCShareInstance();//销毁TRTC实例
lTRTCCloud.Dispose();
lTRTCCloud = null;
if (CallerWindow == null)
{
//关闭程序
Application.Current.Shutdown();
return;
}
CallerWindow.Show();//还原调用者窗口
}

View File

@ -170,6 +170,10 @@ namespace JianGongYun.TRTC.Windows
LiveClassroom.StopVideoSub(AfterLiveSubViewWrap);
this.Hide();
if (LiveClassroom.CallerWindow == null) {
Application.Current.Shutdown();
return;
}
LiveClassroom.CallerWindow.Show();//还原调用者窗口
}

View File

@ -1,6 +1,9 @@
using AduSkin.Controls.Metro;
using AduSkin.Controls;
using AduSkin.Controls.Metro;
using JianGongYun.TRTC;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -22,9 +25,21 @@ namespace JianGongYun.Views
{
InitializeComponent();
BorderBrush = new SolidColorBrush(color: Color.FromRgb(42, 43, 48));
MainWindow main = new MainWindow();
main.Show();
this.Hide();
var roomId = ConfigurationManager.AppSettings["RoomId"];
if (string.IsNullOrWhiteSpace(roomId))
{
MessageBox.Show("未配置房间号!","警告", MessageBoxButton.OKCancel,MessageBoxImage.Error);
Application.Current.Shutdown();
}
LiveClassroom.EnterTheClassroom(null,
new TRTC.Models.ClassroomEntity
{
ClassHead = "课程1",
ClassSubHead = "章节1",
TeacherId = roomId,
TeacherName = "王大锤"
});
this.Close();
}
}
}