# Adaptive stream switch tracking

**URL:** <https://community.wowza.com/t/adaptive-stream-switch-tracking/43890>\
**Category:** Wowza Streaming Engine\
**Created:** [March 24, 2015, 1:25pm UTC](https://community.wowza.com/t/adaptive-stream-switch-tracking/43890 "2015-03-24T13:25:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derek\_Eichele](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Derek\_Eichele](https://community.wowza.com/u/Derek_Eichele)\
**Post date:** [March 24, 2015, 1:25pm UTC](https://community.wowza.com/t/adaptive-stream-switch-tracking/43890/1 "2015-03-24T13:25:55Z")

</div>

I’m attempting to write a custom module to track when the different adaptive streams are requested (both for Cupertino and SmoothStreaming). I’ve created a module that extends ModuleBase, and I’m focusing on the methods

onHTTPSmoothStreamingStreamerRequest (HTTPStreamerSessionSmoothStreamer httpSession, HTTPStreamerSmoothStreamingRequestContext reqContext)

onHTTPCupertinoStreamerRequest (HTTPStreamerSessionCupertino httpSession, HTTPStreamerCupertinoRequestContext reqContext)

The problem is that the documentation on these methods is sparse, if not non-existent. I cannot get any output to my log files from any statements I put in these methods, which leads me to believe that they aren’t being called.

I’ve read this

> [@Apple hls played file tracking form smil file](http://community.wowza.com/t/-/44333):
>
> hi i am using wowza streaming engine 4 , to stream smil file i am able to trace events when file play on flash, and gether informantions like , which file play , time etc, in onConnect() event, precisely i want to get which file is played from my smil file. but in case of apple hls streaming when i try to get file name in onHTTPSessionDestroy() method , eg. public void onHTTPSessionDestroy(IHTTPStreamerSession httpSession) { String streamName = httpSession.getStreamName(); } i…

this

> [@Documentation for ModuleBase](http://community.wowza.com/t/-/44526):
>
> Hi, As I can see from numerous examples around your forum and in your articles, when writing a module you should subclass ModuleBase and when doing so, you get all sorts of application and client events available, like onAppStart, onAppStop, onConnect etc. That’s all good, but I don’t see this documented anywhere ([https://www.wowza.com/resources/serverapi/com/wowza/wms/module/ModuleBase.html](https://www.wowza.com/resources/serverapi/com/wowza/wms/module/ModuleBase.html)). I’m interested in knowing all of the events available to me. I can see the Interfaces are documented e…

and this

> [@Tracking which bitrate quality a player is consuming (adaptive bitrate)](http://community.wowza.com/t/-/43648):
>
> Hi All, I want to keep track of which bitrate stream a particular client is consuming throughout a live session. i want to register following information for a live session t=0 connection from userid=123 — quality =1 (or low quality or 160p) t=15 ----- userId = 123 ------ quality = 2 ( or 240p) t=35 ---- userId 123 ------- quality = 3 (or 360p) t=100 -----userId 123 ------quality = 2 … video players can be using adaptive bitrate rtmp (jwplayer) from web or adaptive bitrate hls (IOS devic…

with no luck.

Is there any better documentation available on these methods, or any working examples I can refer too?

---

<div class="post-metadata">

**Author:** ![Andrew\_Kennedy1](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@Andrew\_Kennedy1](https://community.wowza.com/u/Andrew_Kennedy1)\
**Post date:** [March 26, 2015, 3:47am UTC](https://community.wowza.com/t/adaptive-stream-switch-tracking/43890/2 "2015-03-26T03:47:31Z")

</div>

Hi,

You do need to make sure you are running 4.1.0 at least for this to work. An example implementation would be

```auto
public void onHTTPSmoothStreamingStreamerRequest(HTTPStreamerSessionSmoothStreamer httpSession, HTTPStreamerSmoothStreamingRequestContext reqContext)
{
       IHTTPRequest req = reqContext.getRequest();
       Map<String, String> map = req.getHeaderMap();
       // if the request is missing “my favorite header, reject the session
       if (!map.containsKey("my favorite header"))
       {
              httpSession.rejectSession();
              return;
       }
}

```

You will need to pull apart the request and headers to see what is being requested. You can also use the IVHostHTTPStreamerRequestValidator interface and a quick google did find some examples of implementing this.

Andrew.

---

<div class="post-metadata">

**Author:** ![Derek\_Eichele](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Derek\_Eichele](https://community.wowza.com/u/Derek_Eichele)\
**Post date:** [March 31, 2015, 1:18pm UTC](https://community.wowza.com/t/adaptive-stream-switch-tracking/43890/3 "2015-03-31T13:18:51Z")

</div>

Thanks for the information, I was able to make some progress.

However, I’m still not able to find what I’m looking for. I’m trying to determine which video file (as specified in the smil file) is being streamed. The log entries that I’m able to produce seem to either reference the smil file itself, or the individual chunks. Is there a way to get the info I’m looking for?
