# How to remove IMediaStream object from Wowza to avoid "Hit license limit for publish"

**URL:** https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294
**Category:** Wowza Streaming Engine
**Created:** [December 15, 2015, 3:01pm UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294 "2015-12-15T15:01:23Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Stan\_Rehshetnyk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/stan_rehshetnyk/32/1156_2.png) [@Stan\_Rehshetnyk](https://community.wowza.com/u/Stan_Rehshetnyk)
#### Post date: [December 15, 2015, 3:01pm UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/1 "2015-12-15T15:01:23Z")

</div>

Hello,

Each time flash client calls:

ns = new NetStream();

ns.publish(“streamName”)

ns.close();

I see that Wowza creates IMediaStream object. And if I execute above code for five times - Wowza logs tell “Hit license limit for publishing streams.” I want to properly reuse or shutdown previous stream instances on Wowza side.

How can I achieve that?

I tried without success:

@Override

public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend) {

// bellow doesn’t really work

stream.shutdown();

stream.close();

stream.getClient().getAppInstance().getStreams().clearStreamName(streamName, stream);

}

Here is article which describes how to block new streams, but I need to clean old one instead.

[https://www.wowza.com/docs/how-to-block-a-duplicate-publish-stream](https://www.wowza.com/docs/how-to-block-a-duplicate-publish-stream)

Thank you,

Stan

---

<div class="post-metadata">

### Author: ![Michelle\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/michelle_b/32/394_2.png) [@Michelle\_B](https://community.wowza.com/u/Michelle_B)
#### Post date: [December 30, 2015, 5:23pm UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/2 "2015-12-30T17:23:05Z")

</div>

Hi,

> I want to properly reuse or shutdown previous stream instances on Wowza side.

Can you clarify more on your use case? If a playback client or publisher disconnects, Wowza should automatically destroy the stream without additional interaction. The license limit error is built-in as part of the verification process to see if a trial subscription is exceeding the license usage. Using a paid license key should not trigger the error you are seeing.

Michelle

---

<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 7, 2016, 8:10am UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/3 "2016-01-07T08:10:37Z")

</div>

Try it like this

IClient.setShutdownClient(true);

For example:

```auto
stream.getClient().setShutdownClient(true);

```

For HTTP streams, take a look at this guide:

[How to control access to HTTP streams (cupertinostreaming, sanjosestreaming, smoothstreaming, mpegdashstreaming)](https://www.wowza.com/docs/how-to-control-access-to-http-streams-cupertinostreaming-sanjosestreaming-smoothstreaming-mpegdashstreaming%28Cupertino-Smooth-and-San-Jose%29)

```auto
httpSession.rejectSession();

```

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: [April 4, 2016, 6:27am UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/4 "2016-04-04T06:27:47Z")

</div>

Thank you for updating this post.

Salvadore

---

<div class="post-metadata">

### Author: ![Michelle\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/michelle_b/32/394_2.png) [@Michelle\_B](https://community.wowza.com/u/Michelle_B)
#### Post date: [March 21, 2016, 2:02pm UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/5 "2016-03-21T14:02:56Z")

</div>

Hi,

When the audio source is muted (no audio packets coming in), but the video is still coming in, the connection would not be dropped by Wowza, but would instead be kept open. Are you looking to temporarily suspend --but not disconnect – a given stream if there is no audio?

Michelle

---

<div class="post-metadata">

### Author: ![Stan\_Rehshetnyk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/stan_rehshetnyk/32/1156_2.png) [@Stan\_Rehshetnyk](https://community.wowza.com/u/Stan_Rehshetnyk)
#### Post date: [January 1, 2016, 11:27pm UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/6 "2016-01-01T23:27:05Z")

</div>

Right, I don’t have license limitation issue on production. My clients don’t disconnects during republish. Users may enable mic when they want to speak and mute then.

I worry if clients publish/unpublish streams too often - extra stream objects stays in Wowza memory.

---

<div class="post-metadata">

### Author: ![Stan\_Rehshetnyk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/stan_rehshetnyk/32/1156_2.png) [@Stan\_Rehshetnyk](https://community.wowza.com/u/Stan_Rehshetnyk)
#### Post date: [January 11, 2016, 8:01pm UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/7 "2016-01-11T20:01:23Z")

</div>

I don’t want to drop client connection 🙂

---

<div class="post-metadata">

### Author: ![Stan\_Rehshetnyk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/stan_rehshetnyk/32/1156_2.png) [@Stan\_Rehshetnyk](https://community.wowza.com/u/Stan_Rehshetnyk)
#### Post date: [March 22, 2016, 9:10am UTC](https://community.wowza.com/t/how-to-remove-imediastream-object-from-wowza-to-avoid-hit-license-limit-for-publish/46294/8 "2016-03-22T09:10:30Z")

</div>

Thank you for reply,

There were no video data at my test case.

Let’s close this thread as not many users will encounter this
