Sending texture updates from client to server

I’m working on a multiplayer sample wherein player’s can see each other while playing. Currently, I just want to send the updated webcam video as png images over the network (will worry about compression/encoding later). I’m unsure how to accomplish this.

Initially, I thought I’d have a component attached to my player prefab, say PlayerVideo that overrides the OnSerialize and OnDeserialize methods – however, these functions seem to be for the server to send specific updates to the clients (i.e., your own SyncVar functionality)

It seemed like Commands and ClientRPC calls are what I needed. The flow being:

PlayerVideo.Update() --> GetWebCamFeed() --> SendToServer --> CmdVideoTextureUpdate --> RpcUpdateVideoTexture

How do I send these texture data to the server and from the server to the clients though?
I don’t understand how exactly to use NetworkWriter and NetworkReader to accomplish this.

Here’s some code:

void Update()
        // Send server the updated video texture data as a NetworkWriter object
        if (isLocalPlayer)
            byte[] textureData = m_playerVideoTexture.EncodeToPNG();
            NetworkWriter writer = new NetworkWriter();


    void CmdVideoTextureUpdate(NetworkWriter writer)
        // argument should be NetworkReader, instead it's writer.. how to fix?

    void RpcUpdateVideoTexture(NetworkReader reader)
        if (isLocalPlayer)

        byte[] textureData = reader.ReadBytesAndSize();

How do I convert the NetworkWriter object to a NetworkReader object for the clientrpc to use?
Or is this just the wrong way to do this in the first place?

you could use NetworkWriter.ToArray() and send the array of bytes, then construct a NetworkReader from the array of bytes.