This commit is contained in:
parent
d3faf2b144
commit
b042e1b62d
|
|
@ -129,29 +129,15 @@ const agora = {
|
||||||
},
|
},
|
||||||
// 更新频道信息
|
// 更新频道信息
|
||||||
updateChannelMediaOptions: (bool: boolean) => {
|
updateChannelMediaOptions: (bool: boolean) => {
|
||||||
if (bool) {
|
rtcEngine.updateChannelMediaOptions({
|
||||||
// 摄像头
|
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting, //设置频道场景为直播场景
|
||||||
rtcEngine.updateChannelMediaOptions({
|
clientRoleType: ClientRoleType.ClientRoleBroadcaster, //设置用户角色为主播;如果要将用户角色设置为观众,保持默认值即可
|
||||||
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting, //设置频道场景为直播场景
|
publishMicrophoneTrack: true, //发布麦克风采集的音频
|
||||||
clientRoleType: ClientRoleType.ClientRoleBroadcaster, //设置用户角色为主播;如果要将用户角色设置为观众,保持默认值即可
|
publishCameraTrack: true, //发布摄像头采集的视频
|
||||||
publishMicrophoneTrack: true, //发布麦克风采集的音频
|
publishScreenTrack: true, //设置是否发布屏幕采集的视频
|
||||||
publishCameraTrack: true, //发布摄像头采集的视频
|
autoSubscribeAudio: true, //自动订阅所有音频流
|
||||||
publishScreenTrack: false, //设置是否发布屏幕采集的视频
|
autoSubscribeVideo: true, //自动订阅所有视频流
|
||||||
autoSubscribeAudio: true, //自动订阅所有音频流
|
})
|
||||||
autoSubscribeVideo: true, //自动订阅所有视频流
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
// 屏幕
|
|
||||||
rtcEngine.updateChannelMediaOptions({
|
|
||||||
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting, //设置频道场景为直播场景
|
|
||||||
clientRoleType: ClientRoleType.ClientRoleBroadcaster, //用户角色 1主播 2观众
|
|
||||||
publishMicrophoneTrack: true, //设置是否发布麦克风采集到的音频
|
|
||||||
publishCameraTrack: false, //设置是否发布摄像头采集的视频
|
|
||||||
publishScreenTrack: true, //设置是否发布屏幕采集的视频
|
|
||||||
autoSubscribeAudio: true, //设置是否自动订阅所有音频流
|
|
||||||
autoSubscribeVideo: true, //设置是否自动订阅所有视频流
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// 停止共享屏幕
|
// 停止共享屏幕
|
||||||
stopScreenCapture: () => {
|
stopScreenCapture: () => {
|
||||||
|
|
@ -167,7 +153,7 @@ const agora = {
|
||||||
},
|
},
|
||||||
// 摄像头采集
|
// 摄像头采集
|
||||||
setCameraCapture: (sourceType: number) => {
|
setCameraCapture: (sourceType: number) => {
|
||||||
agora.stopScreenCapture()
|
// agora.stopScreenCapture()
|
||||||
if (sourceType !== option.sourceType) {
|
if (sourceType !== option.sourceType) {
|
||||||
rtcEngine.destroyRendererByConfig(option.sourceType, option.channelId, option.account)
|
rtcEngine.destroyRendererByConfig(option.sourceType, option.channelId, option.account)
|
||||||
option.sourceType = sourceType
|
option.sourceType = sourceType
|
||||||
|
|
@ -193,7 +179,7 @@ const agora = {
|
||||||
// 共享屏幕采集
|
// 共享屏幕采集
|
||||||
setDesktopCapturerVideo: async (targetSource: any, sourceType: number) => {
|
setDesktopCapturerVideo: async (targetSource: any, sourceType: number) => {
|
||||||
if (sourceType !== option.sourceType) {
|
if (sourceType !== option.sourceType) {
|
||||||
await rtcEngine.stopCameraCapture(option.sourceType)
|
// await rtcEngine.stopCameraCapture(option.sourceType)
|
||||||
rtcEngine.destroyRendererByConfig(option.sourceType, option.channelId, option.account)
|
rtcEngine.destroyRendererByConfig(option.sourceType, option.channelId, option.account)
|
||||||
option.sourceType = sourceType
|
option.sourceType = sourceType
|
||||||
agora.setupLocalVideo({
|
agora.setupLocalVideo({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue