# Connect live stream after receiving a request to play by a client

**URL:** <https://community.wowza.com/t/connect-live-stream-after-receiving-a-request-to-play-by-a-client/47272>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [July 14, 2016, 2:22am UTC](https://community.wowza.com/t/connect-live-stream-after-receiving-a-request-to-play-by-a-client/47272 "2016-07-14T02:22:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel\_Smith](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@Manuel\_Smith](https://community.wowza.com/u/Manuel_Smith)\
**Post date:** [July 14, 2016, 2:22am UTC](https://community.wowza.com/t/connect-live-stream-after-receiving-a-request-to-play-by-a-client/47272/1 "2016-07-14T02:22:14Z")

</div>

If a client try to play a stream of my wowza media server, but there is not incoming stream active like [http://wowzaserver:1935/live/myStream/manifest.mpd](http://wowzaserver:1935/live/myStream/manifest.mpd)

¿Can I connect a stream file after the request made by the client?

Is there any module or a class in the api in Wowza to do that? I am thinking to do it with a http provider. ¿Is it possible?

---

<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:** [July 14, 2016, 6:58am UTC](https://community.wowza.com/t/connect-live-stream-after-receiving-a-request-to-play-by-a-client/47272/2 "2016-07-14T06:58:45Z")

</div>

If your clients are RTMP and/or RTSP you would just need to set your stream type to “rtp-live”. When using the “rtp-live” stream type in your application’s configuration file, the source stream will be published to Wowza only when the first client connects to the stream.

For HTTP streams to be active, the data packets need to be packetized. Wowza will start packetizing the HTTP stream as soon as the stream is published.

The stream is not published if there isn’t at least one client requesting the stream. So basically, an HTTP client can not be the first to request the rtp-live stream. Once the stream has been published by an RTMP client, HTTP clients can connect.

I hope this answers your question.

Regards,

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:** [August 10, 2016, 8:51pm UTC](https://community.wowza.com/t/connect-live-stream-after-receiving-a-request-to-play-by-a-client/47272/3 "2016-08-10T20:51:07Z")

</div>

Hi,

You can look into the onHTTPStreamerRequest method.

```auto
    public void onHTTPStreamerRequest(IHTTPStreamerSession httpSession, IHTTPStreamerRequestContext reqContext)
    {
        String value = reqContext.getRequest().getHeader("Header-Name");
    }

```

There are also similar methods for each of the separate protocols.

```auto
    public void onHTTPCupertinoStreamerRequest(HTTPStreamerSessionCupertino httpSession, HTTPStreamerCupertinoRequestContext reqContext)
    {
    }
    public void onHTTPSanJoseStreamerRequest(HTTPStreamerSessionSanJose httpSession, HTTPStreamerSanJoseRequestContext reqContext)
    {
    }
    public void onHTTPSmoothStreamingStreamerRequest(HTTPStreamerSessionSmoothStreamer httpSession, HTTPStreamerSmoothStreamingRequestContext reqContext)
    {
    }
    public void onHTTPMPEGDashStreamerRequest(HTTPStreamerSessionMPEGDash httpSession, HTTPStreamerMPEGDashRequestContext reqContext)
    {
    }

```

---

<div class="post-metadata">

**Author:** ![Manuel\_Smith](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@Manuel\_Smith](https://community.wowza.com/u/Manuel_Smith)\
**Post date:** [July 14, 2016, 10:39pm UTC](https://community.wowza.com/t/connect-live-stream-after-receiving-a-request-to-play-by-a-client/47272/4 "2016-07-14T22:39:15Z")

</div>

Thanks Salvadore.

Well, in the case of HTTP May I Have a filter or something like that? or in an event before, in a module try to connect the stream?

```auto
IApplicationInstance appInstance = vhost.getApplication(app).getAppInstance("_definst_");
appInstance.startMediaCasterStream(streamName, mediacasterType);

```

Is there a common event when a user try to play a stream HTTP like HLS or MPEG-DASH? I have seen that onHTTPSessionCreate only jump in the case of HLS.
