Photon Voice Error

Hi again, we have got Photon Voice working, however when we are playing multiplayer, and the remote player attemps to make a sound other than voice, such as a gun shot, the sound glitches and we get this error. Once we uncheck Photon Voice speaker on the remote player, the error does not occur. Any ideas?

/Users/builduser/buildslave/unity/build/Runtime/Audio/sound/SoundChannel.cpp(367) : Error executing result (An invalid seek position was passed to this function. )
UnityEngine.AudioSource:set_timeSamples(Int32)
PhotonVoiceSpeaker:set_playSamplePos(Int32) (at Assets/PUNVoice/Scripts/PhotonVoiceSpeaker.cs:28)
PhotonVoiceSpeaker:Update() (at Assets/PUNVoice/Scripts/PhotonVoiceSpeaker.cs:157)

Comments

  • Just did some more testing, it seems that our other audio plays correctly, if we are holding down the talk button. So it seems Photon Voice is disabling is stopping our audio source from playing other sounds endless the button is pressed down.
  • JohnTubeJohnTube mod
    edited October 2016
    Hi @HooDoo,

    I'm glad you managed to make Photon Voice work !

    Are you saying that in Photon Voice's Push-To-Talk demo, if no button is pressed then all audio clips are paused or stopped locally? So if you press any of the PTT buttons, sounds (other audio clips attached to any GameObject other than the one to which PhotonVoiceRecorder and PhotonVoiceSpeaker are attached to) are working/playing locally but once button is up again all those sounds stop or pause locally?
  • We fixed it by having 2 audio sources, one for the player sounds, one for the voice!
  • That's great!
    We will update the documentation to prevent such issues for other developers in the future.
    Thank you for your report!
  • Hey @JohnTube
    We are having another problem, when using Photon Voice, it seems that on iOS it makes it so that the sound for the game, plays out of the speaker used for phone calls instead of the proper speakers.
    There is a fix listed here https://github.com/cbaltzer/UnitySpeakerFix
    But how would we go about fixing this in PhotonVoice?

    Thanks!
  • vadimvadim mod
    edited October 2016
    PhotonVoice calls Microphone.Start() in 3 cases: in PhotonVoiceRecorder.Start() (when you instantiate player e.g.) , and when PhotonVoiceRecorder.MicrophoneDevice or PhotonVoiceNetwork.MicrophoneDevice are updated from user code. For 2 latest cases, iPhoneSpeaker.ForceToSpeaker() can be called right after these updates.
    For the first case, you can do so in first Update() call of one of the components of PhotonVoiceRecorder object.
    As a quick and simple solution, you can find Microphone.Start in PhotonVoice sources and add iPhoneSpeaker.ForceToSpeaker() there.
  • @vadim Thanks! We gave it a shot, added that into the Voice Recorder script, except after importing the fix of git hub we get this error in XCode: ([(NSString*)route rangeOfString:@Head].location != NSNotFound))

    Is there an alternate way to make it play by default through the proper speakers? Is this not a common problem that many people face with Photon Voice?

    Thanks, I hope we can find a solution.



  • @vadim Just bumping this..
  • I tried that solution but still not working.
    My audio works when I don't have headphones, but as soon as I plug them in, I can hear the audio for a few ms and then stops. I still hear photon voice audio, but not the other audio.
    In the console I'm getting the following error:
     [avas] AVAudioSession.mm:1074:-[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session
    
  • Hey @acroca , Possibly, could the problem be that you need to have another audio source? We were having a problem where player sounds would not play over multi player(they would but they would glitch for a second, and then you would only hear the sounds if they were talking), because photon voice was using the same audio source, so what we did was just created another audio source as a parent of our player and used that for all the player sounds. Could this be the problem?
  • Hey @HooDoo, I don't think so. I have a screen with its own audio source created by EasyMovieTexture. So I have an audio source per player and also the screen.
  • Hey admins, any update on the question I asked about playing through the correct speaker?
  • As far as I can see this is general problem not related directly to Photon Voice. It may take some time to try different approaches on our side. May be you can try them on simple audio playback test? And, if it does not work, ask Unity support.
  • If you have already tried using the fix mentioned by @HooDoo, did you try the updated version found over here, too? Since the fix uses some deprecated function calls, you might give the updated one a try.

    Maybe you can also share the current state of the projects you are working on and - especially - the issues you are currently facing when using Photon Voice.
Sign In or Register to comment.