How can I extract data messages that my live encoder has embedded into the stream?

Imagine you have set up your encoder so that it embeds ad triggers into the live stream, with the name myAdTrigger and carrying the URL of the ad call. With a normal NetStream you would need to create a custom callback function called myAdTrigger on your NetStream client object. With HDNetStream it is much simpler; set a listener on the class's DATA_MESSAGE event. This sends you all data messages that are embedded in the stream. The event data object will hold an object with two properties: name and value. Filter out those where event.data.name == “myAdTrigger” and recover your ad URL using event.data.value.