# Wowza Streaming Engine

## Player-Side Ad Insertion ReadMe

## Contents

The player-side ad insertion .zip contains the following files:

- /java/HTTPProviderAdBreakInsertion.java - An HTTP Provider that allows Wowza Streaming Engine to accept an HTTP POST request to inject a data event into the ingested stream that's requesting an ad break.
- /java/ModuleCupertinoLiveOnAdBreakToID3.java - A Wowza Streaming Engine module that listens for the data event in the stream during transmuxing. It converts the event to an ID3 tag in the Apple HLS stream that Wowza Streaming Engine sends to the player.
- /html/live_ad.html - HTML code that contains the button to insert the ad break and plays the video. Includes the JW Player custom code that detects the ad break, makes a Video Ad Serving Template (VAST) call, and plays the ad.
- /html/testVAST.xml - The VAST XML file that points to the sample ad. For this demo, it's deployed to a local web server.
- /html/testAd.mp4 - The sample ad.
- readme.html - This readme file.

## Deployment

1. Configure Wowza Streaming Engine to use the live application and a stream called myStream. Make sure Apple HLS is selected as a playback type.
2. Copy the contents of /html/ to a local web server, for example, into localhost/ads/.
3. Compile the two Java modules into a .jar file and then deploy the .jar file to [install-dir]/lib/.
4. Configure the HTTP Provider by editing [install-dir]/conf/VHost.xml and adding the following to the host port 8086 section:

       <HTTPProvider>
       	<BaseClass>com.wowza.wms.plugin.addemo.HTTPProviderAdBreakInsertion</BaseClass>
       	<RequestFilters>insertadmarker*</RequestFilters>
       	<AuthenticationMethod>none</AuthenticationMethod>
       </HTTPProvider>

   > Note: Be sure to add it immediately above the last provider in the 8086 list, http.HTTPServerVersion.

5. Add the module by editing the [install-dir]/conf/live/Application.xml and adding the following to the Modules section:

       <Module>
       	<Name>ModuleAdID3Tags</Name>
       	<Description>Convert ad requests to ID3 tags</Description>
       	<Class>com.wowza.wms.plugin.addemo.ModuleCupertinoLiveOnAdBreakToID3</Class>
       </Module>

6. Restart the Wowza Streaming Engine server and, when you're ready, start the stream source for the live application.
7. In a web browser, load localhost/ads/live_ad.html.
8. Click the Insert Ad button in live_ad.html to make the HTTP POST call for this demonstration.

The sample ad appears in the player when the ad break occurs in the stream.

© 2007-2016 Wowza Media Systems, LLC. All rights reserved.