AgoraIO / Advanced-Video

MIT License
261 stars 336 forks source link

change audience role to broadcaster #202

Closed saimt closed 3 years ago

saimt commented 4 years ago

Hi, I have been trying to change the role of specific audience member to broadcaster. So that the screen sharing is mine but I can hear the audio of other co-host.

I have been following this guide. https://docs.agora.io/en/faq/host_set_role I have converted role of audience member, but main broadcaster is not able to hear the audio of co-host. I'm not sure if co-host's audio is streaming, or maybe it's streaming but main broadcaster is not receiving it.

On audience side after converting the role I did:

rtcEngine.setClientRole(.broadcaster)
rtcEngine.enableLocalAudio(true)
rtcEngine.muteLocalAudioStream(false)

An on Broadcaster Side I have enabled remote audios

kit.setDefaultAudioRouteToSpeakerphone(true)
kit.enableAudio()
kit.muteAllRemoteAudioStreams(false)

Any help would be appreciated

brianxcli commented 4 years ago

Which platform are you using?

saimt commented 4 years ago

I’m using iOS

saimt commented 4 years ago

Is there any way possible that 2 broadcasters can hear each other? Right now broadcaster can't hear anyone else

plutoless commented 4 years ago

can your audience hear broadcaster?

saimt commented 4 years ago

yes audience can hear a broadcaster. What I want to achieve is that if there are 2 broadcasters, they can hear each other.

plutoless commented 4 years ago

if audience can hear broadcaster, then broadcaster should be able to hear each other, could you pls help reproduce the issue and share the channel name + timestamp when the issue happened for me to investigate?

saimt commented 4 years ago

I did some research and figured out that broadcast extensions only support streaming and not receiving, so even if you do this kit.muteAllRemoteAudioStreams(false) in AgoraUploader you still won't be able to receive streams from others (whether audience or another broadcaster).

Correct me if I'm wrong.

plutoless commented 4 years ago

@saimt why do you want to hear others from extension? does it work if you do this in your main process?

saimt commented 4 years ago

I tried doing it from the main process. I did the following things:

  1. Created a new instance of RTCEngine (couldn't figure out any way to access the instance running in broadcast extension. if there is any way please tell me.)
  2. Joined the same channel (on which I am broadcasting) as a broadcaster.

This didn't work. Is there any way this can be done?

plutoless commented 4 years ago

main process can't access variables in extension. Could you pls share me the channel name you used, so that i can take a look from backend?

plutoless commented 4 years ago

maybe it's worth to start with this tutorial first? https://github.com/AgoraIO/Basic-Video-Call/tree/master/One-to-One-Video/Agora-iOS-Tutorial-Swift-1to1 this is a simple tutorial which you can verify if broadcaster role actually works or not.

saimt commented 4 years ago

Hi, I used the channel name "qwe" for broadcast testing. I have tried the link you shared. It works fine with multiple broadcasters, but this is for video sharing. I want to do the same thing with screen sharing.

plutoless commented 4 years ago

let me double verify, currently the issue is you have one process joining channel in main process, and the other one joining channel in extension. Both are broadcasters and they can't hear each other, right?

saimt commented 4 years ago

Broadcaster joining with main process can hear the other broadcaster who has joined with extension. But the broadcaster who joined with extension cannot hear other broadcaster who joined with the main process.

Broadcaster 1: Joins using extension cannot hear Broadcaster 2.

Broadcaster 2: Joins using main process can hear Broadcaster 1.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.