Bolt + VoiceChat Integration (Sending custom data types or structs?)

Options
bigd
bigd
edited October 2016 in Photon Bolt
Took a stab today and trying to get this to work.

I've been able to set the voice recorder device and playback audio locally, the problem is sending data over the network using BOLT.

According to the pdf, the transmission consists of the following elements:
public struct VoiceChatPacket
{
public VoiceChatCompression Compression;
public int Length;
public byte[] Data;
public int NetworkId;
}
Integers are easy, since they are a known bolt data type, but byte arrays and an object? How can you send those?

Comments

  • stanchion
    Options
    You can use either event.BinaryData or streaming to send byte arrays

    I recommend this, it can be made to work with Bolt easily
    https://github.com/fholm/unityassets/tree/master/VoiceChat
  • bigd
    Options
    Thanks stanchion, actually that's the one I'm using now.

    Have you gotten this to work yourself? I looked into both these methods last night and it is my understanding the event.binarydata method will show you the raw data of an event, but I didnt think you could create an event that sends a byte array as a property?

    The streaming method is the only option that I think would work, but with that I would still have to convert the struct to a byte array and convert it back again after its been sent. Is that your understanding as well?
  • stanchion
    Options
    Yes, you can send an event using byte arrays. Just put into BinaryData what you want, not exceeding half of the setting you have for packet size.

    Here is an example http://hastebin.com/uwuqesiqoc.cpp
  • bigd
    Options
    This is exactly what I needed. Thank you sir!