# Tracking which bitrate quality a player is consuming (adaptive bitrate)

**URL:** <https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [December 22, 2014, 6:52pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648 "2014-12-22T18:52:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [December 22, 2014, 6:52pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/1 "2014-12-22T18:52:52Z")

</div>

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 devices) or single bitrate rtsp (android).

I found a module mentioned at [https://www.wowza.com/docs/how-to-log-client-count-and-metadata-for-a-stream-every-10-seconds-modulelogviewercounts](https://www.wowza.com/docs/how-to-log-client-count-and-metadata-for-a-stream-every-10-seconds-modulelogviewercounts) which gives me info regarding count of connections but not on the bitrates of each connection. Is there a module(s) where i can detect

1)when a connection is switching stream quality

1. when a connection is starting

3)when a connection is ending.

---

<div class="post-metadata">

**Author:** ![1111](https://avatars.discourse-cdn.com/v4/letter/1/71e660/32.png) [@1111](https://community.wowza.com/u/1111)\
**Post date:** [December 22, 2014, 3:54pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/2 "2014-12-22T15:54:32Z")

</div>

Hello,

From what I’ve seen mentioned in another post there’s a new API that might help.

See this thread: [Apple hls played file tracking form smil file](http://community.wowza.com/t/-/44333)

---

<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:** [December 25, 2014, 1:13pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/3 "2014-12-25T13:13:26Z")

</div>

For RTMP you can use play2 so

```auto
	public void play2(IClient client, RequestFunction function,
	        AMFDataList params) {
		
	}

```

In the params object you should receive the RTMP request to change streams with some other information. Although the sever may receive a request it does not mean it will be actioned and a callback is made to the client if successful.

Andrew

---

<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:** [January 5, 2015, 4:10am UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/4 "2015-01-05T04:10:30Z")

</div>

Hi,

If play2 is not being called then no switching is taking place. The streams do need to be active for switch to occur so if they are not available on the edge the player will not switch.

Andrw.

---

<div class="post-metadata">

**Author:** ![sal\_jefferson](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sal\_jefferson](https://community.wowza.com/u/sal_jefferson)\
**Post date:** [December 25, 2014, 7:16am UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/5 "2014-12-25T07:16:11Z")

</div>

Hello.

This has been made available by extending ModuleBase:

```auto
public void onHTTPCupertinoStreamerRequest(HTTPStreamerSessionCupertino httpSession, HTTPStreamerCupertinoRequestContext reqContext){
		getLogger().info("onHTTPCupertinoStreamerRequest");
	}

```

It looks like this has not been added to the API documentation yet.

Kind regards,

Salvadore

---

<div class="post-metadata">

**Author:** ![sal\_jefferson](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sal\_jefferson](https://community.wowza.com/u/sal_jefferson)\
**Post date:** [January 5, 2015, 6:33am UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/6 "2015-01-05T06:33:30Z")

</div>

ngrp do not get forwarded to the edge. With this HHTPProvider, you can create a SMIL from using the medialist tool on the origin and create a file that you host in the content folder on the edge:

[How to create and play SMIL files with streams created by Wowza Transcoder](https://www.wowza.com/docs/how-to-create-and-play-smil-files-with-streams-created-by-wowza-transcoder)

I hope this helps.

Kind regards,

Salvadore

---

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [December 23, 2014, 3:17pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/7 "2014-12-23T15:17:08Z")

</div>

I am not able to find any info about the new methods (onHTTPCupertinoStreamerRequest) in the api documentaiton. [https://www.wowza.com/resources/WowzaStreamingEngine\_ServerSideAPI.pdf](https://www.wowza.com/resources/WowzaStreamingEngine_ServerSideAPI.pdf).

---

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [December 23, 2014, 5:12pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/8 "2014-12-23T17:12:58Z")

</div>

Hi,

I found a interface IMediaStreamNameAliasProvider2 which looks promising for my use case. It has a bunch of resolvePlayAlias methods. However couple of queries

1. does these method gets called every time a client tries to switch from one rendition to another.

2. is there a better/alternate way to do this since in these methods i will have to parse stream names to check which bitrate is requested . ie (streamName = myStream\_360p will mean player asked for 360p rendition).

---

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [December 25, 2014, 7:19pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/9 "2014-12-25T19:19:47Z")

</div>

correct me if i am wrong …onHTTPCupertinoStreamerRequest this method as name suggest will apply only for hls playback. What about the rtmp playback. How to track when a particular player switches from one bitrate to another in dynamic rtmp playback.

---

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [January 3, 2015, 10:25pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/10 "2015-01-03T22:25:01Z")

</div>

Thanks. using onHTTPCupertinoStreamerRequest() and play2() i am able to track when clients switches between various bitrates.

Also i am trying to track when a player disconnects the session. I found IClientNotify has a method onClientDisconnect(IClient client) which i can use.

But i am not able to get stream name from client object. there are some methods in client class ( like getUri) which give me url of stream but that url does not contain the stream Name.

---

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [January 5, 2015, 5:17pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/11 "2015-01-05T17:17:54Z")

</div>

an Update - when i was testing with a flash player (StrobeMediaPlayer) play2() method was being called whenever switching was taking place . But when i am trying to use Jwplayer to play the streams play2() is not getting called.

i am using a amlst module to serve the smil file to jwplayer.

[http://localhost:1935/edge/amlst:myStream/jwplayer.smil](http://localhost:1935/edge/amlst:myStream/jwplayer.smil) produces following smil file-

My question is how does jwplayer switches between streams if it doesnt use play2().

Also i observed that when i use strobe player where i have added in some code to call FCSubscribe() it “holds” the video streams on edge application even when all of them are not actively consumed and i can see all the renditions of streams under “incoming streams” section of my edge app .

But when using jwplayer edge app shows just one rendition and keeps on showing that rendition forever. So i wonder if adaptive bitrate switching is actually happening or not when using jwplayer.

---

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [January 5, 2015, 5:56pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/12 "2015-01-05T17:56:29Z")

</div>

So how to fix this . is there a way from server side module through which i can do the job of FCSubscribe ie to hold all rendition of streams on edge app . i dont think i will have access to jwplayers source code so doing something on server side appears to be my only option.

---

<div class="post-metadata">

**Author:** ![Gaurav\_Mishra1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gaurav\_Mishra1](https://community.wowza.com/u/Gaurav_Mishra1)\
**Post date:** [January 5, 2015, 6:13pm UTC](https://community.wowza.com/t/tracking-which-bitrate-quality-a-player-is-consuming-adaptive-bitrate/43648/13 "2015-01-05T18:13:34Z")

</div>

i already have a custom IMediaListProvider in a Edge app module which generates smil file for jwplayer.

if i hit this url ([http://localhost:1935/edge/amlst:myStream/jwplayer.smil](http://localhost:1935/edge/amlst:myStream/jwplayer.smil) ) in browser i get a valid smil file . But problem i am facing is i want to make sure that all consumers of streams to connect on edge servers. For achieving that i will have to make sure all renditions of stream be available to edge application.

One way to achieve this is to call Netstream.FCSubscribe() from video player for each rendition. Since i cannot update code of jwplayer , Is there a way to achieve the same from server side ie to copy renditions of stream on edge app on all edge servers ?
