How do I extract the audio source / audio clip from myself and other users in the room?

Hello, I have a project setup. Voice chat is working fine. However I want to make it so I can stand infront of a microphone (or other game object) in my scene and my voice will transmit across to speakers I have setup around the scene.
I have a system in place already that takes in a audio source and then it plays said audio source out of any audio source in the "speaker" list.

But I can not seem to extract the audio source / audio clip from myself or other users
I tried stashing everyone in a gameobject list and then accessing said list, checking the name against the speaker and then doing theirGameObject.GetComponent<AudioSource>() but no luck.

I tried using PhotonVoiceView.RecorderInUse.AudioClip

nothing. I'm in the dark here...

Can someone help me out?

Comments

  • Hi @Lyraedan,

    Thank you for choosing Photon!

    Did you see this?
  • LyraedanLyraedan
    edited May 2020
    I have. It wasn't what I was looking for. I managed to find a solution.

    By tagging my player object "Player" and other player "OtherPlayer" i was able to do a foreach gameobject in objects with tag "OtherPlayer"

    So to photon your local player has the tag Player and other people will have the tag OtherPlayer

    I would then pull their nickname and check if they are the user that triggered the radius of the microphone and to check if the microphone was already in use

    If it wasn't in use and the names match; I would then set my speaker's input device as the other player gameobject and set the audio source (the source the speakers are listening to) to otherPlayer.GetComponent<PhotonVoiceView>().SpeakerInUse.GetComponent<AudioSource>()

    Then it worked fine

    My problem I was trying to set it up from the perspective of the speaker when really I should of been setting it up as if I was a member of the audience listening in.
Sign In or Register to comment.