Genvid Streams

The GenvidStreams prefab object defines a data stream from your game for your broadcast session. You can have multiple data streams for the same GenvidStreams object. You need to modify the size of the Ids to have the number of data stream required for your application. Each element of this array contains several properties that can be modified:

Genvid Streams inspector view
Id
The name of the data stream. Make sure to use a unique name compared to the other streams used in your application.
Framerate

The rate at which the On Submit Stream function will be executed. 0 is the default value.

  • 0 means that the stream data is sent every frame (depending directly on the game framerate).

  • All other values use the formula: Min(value, Game Framerate).

    For example, in a game running at 30 FPS:

    • At value 10, the stream is sent at Min(10, 30) = 10 Frames per second.
    • At value 100, the stream is sent at Min(100, 30) = 30 Frames per second.
On Submit Stream (String)

This is the function that will be executed according to the framerate selected. The String parameter received will always be the stream name. In the methods called afterwards, you are free to use the best method to send your data:

  • SubmitAnnotation(object streamID, object data)
  • SubmitGameData(object streamID, object data)
  • SubmitNotification(object streamID, object data)

Each method requires:

  • The stream name that will receive the data and
  • The data formatted into a class.

For example, this is how we performed the submit data for the sample:

    public void SubmitGameData(string streamId)
    {
        ProjView = m_sceneCamera[m_currentActiveCamera].projectionMatrix * m_sceneCamera[m_currentActiveCamera].worldToCameraMatrix;

        if (GenvidSessionManager.IsInitialized)
        {
            //Getting the cube information and send it into the game data stream
            var cubeDataArray = from c in m_Cubes select c.InfoData;
            CubesGameData gameData = new CubesGameData()
            {
                cubes = cubeDataArray.ToArray(),
                MatProjView = ProjView,
                camera = m_cameraCounter,
                scene = m_changeSceneCounter
            };

            GenvidSessionManager.Instance.Session.Streams.SubmitGameData(streamId, gameData);
        }
    }