# How to pass AMFDataByteArray from HTTPProvider to Module?

**URL:** https://community.wowza.com/t/how-to-pass-amfdatabytearray-from-httpprovider-to-module/93911
**Category:** Wowza Streaming Engine
**Tags:** wowza-streaming-engine
**Created:** [October 4, 2021, 9:46pm UTC](https://community.wowza.com/t/how-to-pass-amfdatabytearray-from-httpprovider-to-module/93911 "2021-10-04T21:46:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Dan\_Farrow](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@Dan\_Farrow](https://community.wowza.com/u/Dan_Farrow)
#### Post date: [October 4, 2021, 9:46pm UTC](https://community.wowza.com/t/how-to-pass-amfdatabytearray-from-httpprovider-to-module/93911/1 "2021-10-04T21:46:44Z")

</div>

I have used the tutorials on HTTPProviders and Modules to send text based metadata into a module and insert it as timed ID3 metadata in an HLS stream. I used these tutorials:

[https://www.wowza.com/docs/how-to-inject-timed-metadata-using-a-wowza-streaming-engine-http-provider](https://www.wowza.com/docs/how-to-inject-timed-metadata-using-a-wowza-streaming-engine-http-provider)

[https://www.wowza.com/docs/how-to-convert-ontextdata-events-in-a-live-or-vod-stream-to-timed-events-id3-tags-in-an-apple-hls-stream](https://www.wowza.com/docs/how-to-convert-ontextdata-events-in-a-live-or-vod-stream-to-timed-events-id3-tags-in-an-apple-hls-stream)

Now, I want to do the same thing but send an AMFDataByteArray from the HTTP Provider to the Module. In my **HTTP Provider** I have:

```
AMFDataByteArray amfDataBytes = AMFDataByteArray.wrap(data);
// this outputs a size of 90166!!
WMSLoggerFactory.getLogger(CLASS).info("sendBinaryMetadata amfDataBytes BEFORE SENDING SIZE - " + amfDataBytes.size());

AMFDataObj amfDataObj = new AMFDataObj();
amfDataObj.put("wowzaConverter", "basic_string");
amfDataObj.put("payload", amfDataBytes);

```

In the **module** I have:

```
AMFData amfDataItem = dataObj.get("payload");
getLogger().info("--> MODULE binary amfDataItem.toString " + amfDataItem.toString() );
AMFDataByteArray amfBytes = (AMFDataByteArray)amfDataItem;

```

I get an error here that AMFDataItem cannot be cast to AMFDataByteArray. However, if you look at the logging line above that, the function “amfDataItem.toString()” outputs:

```
--> MODULE binary amfDataItem.toString {Obj[]: endian: "bigEndian", length: 90166.0, position: 90166.0, objectEncoding: 3.0}

```

That “ **length** ” of **90166** is the exact size the byte array I am sending, so the data MUST be here. How do I get it!?

---

<div class="post-metadata">

### Author: ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)
#### Post date: [October 6, 2021, 8:20pm UTC](https://community.wowza.com/t/how-to-pass-amfdatabytearray-from-httpprovider-to-module/93911/2 "2021-10-06T20:20:27Z")

</div>

This isn’t my area of expertise, but I asked one of our top engineers and he said:

“It’s not really the right way to use AMFDataByteArray. It is for sending data across an rtmp netConnection, not internally within the server. For that, he can just use a POJO.”

I would suggest sending in a support ticket so we can work directly with your configuration. Sorry I can’t be of more help.

---

<div class="post-metadata">

### Author: ![Connessione](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Connessione](https://community.wowza.com/u/Connessione)
#### Post date: [October 7, 2021, 6:23pm UTC](https://community.wowza.com/t/how-to-pass-amfdatabytearray-from-httpprovider-to-module/93911/3 "2021-10-07T18:23:20Z")

</div>

What is it that you want to send ? Internal to the server everything is in jvm. So just create classes and do object exchange.

Simplest is to have static methods (although not the best practice) and have one module call the static method of another module or object and pass in the data in terms of java data types. Static methods are mostly useful when you know there is one instance of the class/module that you want to access the method on.

---

<div class="post-metadata">

### Author: ![Dan\_Farrow](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@Dan\_Farrow](https://community.wowza.com/u/Dan_Farrow)
#### Post date: [October 8, 2021, 3:23pm UTC](https://community.wowza.com/t/how-to-pass-amfdatabytearray-from-httpprovider-to-module/93911/4 "2021-10-08T15:23:38Z")

</div>

Thanks for the pointers. As suggested, I wound up creating a static method on the Module so I could set a variable with the byte[] data I want to send. Then, I trigger the actual ID3 insertion using the HTTPProvider to call “stream.sendDirect()”. This approach works!
