How to enable AMF3 metadata and send AMFDataByteArray() to streamSendirect()? NegativeArraySizeException

Hi, I am trying to inject a byte array as AMF data into my stream, I get this message:

AMFDataByteArray.deserialize[15400:4] : java.lang.NegativeArraySizeException|at com.wowza.wms.amf.AMFDataByteArray.deserialize(AMFDataByteArray.java:175)|at com.wowza.wms.amf.AMFDataByteArray.<init>(AMFDataByteArray.java:83)|a

I use this to create the AMFDataByteArray and I know the dataBytes array is 15400 bytes:

AMFDataContextDeserialize amf3Context = new AMFDataContextDeserialize();
amf3Context.setObjectEncoding(AMFDataObj.AMF_LEVEL3);
AMFDataByteArray amfByteData = new AMFDataByteArray(ByteBuffer.wrap(dataBytes), amf3Context);

I am not sure what to do here.

. Also which function do I used to inject this into the stream?

stream.sendDirect("onDataFunction", amfData);

or

stream.sendDirectAMF3("onDataFunction", amfData);

??

I figued it out in the HttpProvider I do:

AMFDataObj amfData = new AMFDataObj();
AMFDataByteArray amfByteData = AMFDataByteArray.wrap(dataBytes);
amfData.put(“payload”, amfByteData);
stream.sendDirectAMF3(“onRaceFinisher”, amfData);

and in the module:

Sometimes your are the best help for yourself :slightly_smiling_face:. Thanks for sharing this information.

Woops, my post got truncated, just to specify:

I figured it out in the HttpProvider I do:

AMFDataObj amfData = new AMFDataObj();
AMFDataByteArray amfByteData = AMFDataByteArray.wrap(dataBytes);
amfData.put(“payload”, amfByteData);
stream.sendDirectAMF3(“onRaceFinisher”, amfData);

and in the module, in onFillChunkDataPacket :

AMFDataObj dataObj = amfList.getObject(1);
AMFData amfData = dataObj.get("payload");
AMFDataByteArray amfDataBytes = (AMFDataByteArray)amfData;
byte[] dataPayload = amdDataBytes.toArray();