protected virtual void OnMessageReceived(AirVRMessage message) { if (MessageReceived != null) { MessageReceived(message); } }
// handle AirVRMessages private void onAirVRMessageReceived(AirVRMessage message) { AirVRServerMessage serverMessage = message as AirVRServerMessage; int playerID = serverMessage.source.ToInt32(); if (serverMessage.IsSessionEvent()) { if (serverMessage.Name.Equals(AirVRServerMessage.NameConnected)) { onAirVRSessionConnected(playerID, serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameDisconnected)) { onAirVRSessionDisconnected(playerID, serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameProfilerFrame)) { onAirVRProfilerFrameReceived(playerID, serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameProfilerReport)) { onAirVRProfilerReportReceived(playerID, serverMessage); } } else if (serverMessage.IsPlayerEvent()) { if (serverMessage.Name.Equals(AirVRServerMessage.NameCreated)) { onAirVRPlayerCreated(playerID, serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameActivated)) { onAirVRPlayerActivated(playerID, serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameDeactivated)) { onAirVRPlayerDeactivated(playerID, serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameDestroyed)) { onAirVRPlayerDestroyed(playerID, serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameShowCopyright)) { onAirVRPlayerShowCopyright(playerID, serverMessage); } } else if (message.Type.Equals(AirVRMessage.TypeUserData)) { onAirVRPlayerUserDataReceived(playerID, serverMessage); } }
private void onAirVRMessageReceived(AirVRMessage message) { AirVRServerMessage serverMessage = message as AirVRServerMessage; int srcPlayerID = serverMessage.source.ToInt32(); if (srcPlayerID != playerID) { return; } if (serverMessage.IsMediaStreamEvent()) { if (serverMessage.Name.Equals(AirVRServerMessage.NameInitialized)) { onAirVRMediaStreamInitialized(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameStarted)) { onAirVRMediaStreamStarted(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameEncodeVideoFrame)) { onAirVRMediaStreamEncodeVideoFrame(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameStopped)) { onAirVRMediaStreamStopped(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameCleanupUp)) { onAirVRMediaStreamCleanedUp(serverMessage); } } else if (serverMessage.IsInputStreamEvent()) { if (serverMessage.Name.Equals(AirVRServerMessage.NameRemoteInputDeviceRegistered)) { onAirVRInputStreamRemoteInputDeviceRegistered(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameRemoteInputDeviceUnregistered)) { onAirVRInputStreamRemoteInputDeviceUnregistered(serverMessage); } } }
// handle AirVRMessages private void onAirVRMessageReceived(AirVRMessage message) { AirVRClientMessage clientMessage = message as AirVRClientMessage; Assert.IsNotNull(clientMessage); if (MessageReceived != null) { MessageReceived(clientMessage); } if (clientMessage.IsSessionEvent()) { if (clientMessage.Name.Equals(AirVRClientMessage.NameSetupResponded)) { onAirVRSetupResponded(clientMessage); } else if (clientMessage.Name.Equals(AirVRClientMessage.NameRenderPrepared)) { onAirVRRenderPrepared(clientMessage); } else if (clientMessage.Name.Equals(AirVRClientMessage.NamePlayResponded)) { onAirVRPlayResponded(clientMessage); } else if (clientMessage.Name.Equals(AirVRClientMessage.NameStopResponded)) { onAirVRStopResponded(clientMessage); } else if (clientMessage.Name.Equals(AirVRClientMessage.NameDisconnected)) { onAirVRDisconnected(clientMessage); } } else if (message.Type.Equals(AirVRMessage.TypeUserData)) { onAirVRUserDataReceived(message); } }
private void onAirVRMessageReceived(AirVRMessage message) { AirVRServerMessage serverMessage = message as AirVRServerMessage; int srcPlayerID = serverMessage.source.ToInt32(); if (srcPlayerID != playerID) { return; } if (serverMessage.IsMediaStreamEvent()) { if (serverMessage.Name.Equals(AirVRServerMessage.NameInitialized)) { onAirVRMediaStreamInitialized(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameStarted)) { onAirVRMediaStreamStarted(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameEncodeVideoFrame)) { onAirVRMediaStreamEncodeVideoFrame(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameSetCameraProjection)) { onAirVRMediaStreamSetCameraProjection(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameStopped)) { onAirVRMediaStreamStopped(serverMessage); } else if (serverMessage.Name.Equals(AirVRServerMessage.NameCleanupUp)) { onAirVRMediaStreamCleanedUp(serverMessage); } } }
private void onAirVRUserDataReceived(AirVRMessage message) { Delegate.AirVRClientUserDataReceived(message.Data_Decoded); }