旁路推流
This commit is contained in:
parent
565d247296
commit
6736748a6f
|
@ -28,8 +28,10 @@ namespace JianGongYun.TRTC
|
|||
/// </summary>
|
||||
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;
|
||||
/// <summary>
|
||||
/// TRTC实例
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动麦克风
|
||||
/// </summary>
|
||||
|
@ -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 = "提醒",
|
||||
|
|
|
@ -168,6 +168,9 @@ namespace JianGongYun.TRTC.Windows
|
|||
LiveClassroom.StopMic();
|
||||
LiveClassroom.StopVideoMain(AfterLiveViewWrap);
|
||||
LiveClassroom.StopVideoSub(AfterLiveSubViewWrap);
|
||||
|
||||
this.Hide();
|
||||
LiveClassroom.CallerWindow.Show();//还原调用者窗口
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue