Wowza Community

How to disable "?dvr" handling for some application

Hi Scott,

I have an application with custom module, which provide the redirect to another vhost/application.

But, unfortunately, if URI contains “?dvr”, it does not invoke method onHTTPSessionCreate, because the query string “?dvr” handled by nDVR before it.

How to disable “?dvr” handling for some application, but not for all?

Maybe I can invoke some method within onAppStart, to disable nDVR?

You can remove “dvrrecorder” from the DVR section of your Application.xml.

Falcon-M,

Sorry for all the confusion on this thread. I think we now understand at least at a high level what you want to do. On the Wowza Server development side we have chatted internally about possible solutions to this problem. We are afraid that if we change the behavior of the HTTP processing for nDVR based URLs that we will not be able to maintain this behavior long term. So we don’t want to provide a change for this today then break it in a future build. Because of this we need to gather more information to see if there is some other way to solve this problem.

First, what is the overall goal? I assume you are using the redirect mechanism to re-route requets. More details on exactly what you are trying to build will help. Are you redirecting all URLs that enter this application to a different location? Are you only redirecting a small percentage of requests? We need to understand the mechanics.

One possible solution is to create an HTTP provider to do the redirects. An HTTP provider can be attached to any port in VHost.xml. There is more information here:

https://www.wowza.com/docs/http-providers

An HTTP Provider is like a mini java servlet. The HTTP provider is invoked based on the strucutre of the URL. For example, if you setup an HTTP provider like this:

<HTTPProvider>
	<BaseClass>com.wowza.wms.falconm.HTTPProviderMyRedirector</BaseClass>
	<RequestFilters>*doredirect</RequestFilters>
	<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

Then all URLs that end in doredirect will be handled by the redirect HTTP provider. You can then perform the redirect in the HTTP provider. For example, say you use these URLs for streaming:

http://[wowza-ip-address]/vod/mp4:sample.mp4/playlist.m3u8
http://[wowza-ip-address]/vod/mp4:sample.mp4/manifest.f4m
http://[wowza-ip-address]/vod/mp4:sample.mp4/Manifest
http://[wowza-ip-address]/vod/mp4:sample.mp4/playlist.m3u8?dvr

To enable redirection you would add the doredirect item to the patch to first force the URLs through the redirector:

http://[wowza-ip-address]/vod/mp4:sample.mp4/playlist.m3u8/doredirect
http://[wowza-ip-address]/vod/mp4:sample.mp4/manifest.f4m/doredirect
http://[wowza-ip-address]/vod/mp4:sample.mp4/Manifest/doredirect
http://[wowza-ip-address]/vod/mp4:sample.mp4/playlist.m3u8/doredirect?dvr

Would this be a viable solution?

Charlie

I am not sure I understand the connected TV issue. It should look the same to the connected TV. It is still just a simple redirect. You do the redirect in the HTTPProvider. The same way you would do it from the onHTTSessionCreate handler. So no difference. Just a slight change to the initial URL. As far as RTMP and RTSP just handle them the same way you do today. So no change there. It is just the HTTP based streamers that would use the HTTPProvider. The HTTPProvider would work off the same port as teh streaming.

Charlie

“netconnection” is not a valid StreamType. You probably want StreamType “live”

Richard

It seems like the answer is that you should configure an application for DVR if you want to use it sometimes, and control whether it is used with the querystring param. Whether or not to include the “?DVR” querystring param in the playback URL should be a decision you make in your application server logic.

Otherwise, help me understand the problem scenario. When does your player use a playback URL with the “?DVR” querystring that you don’t really want to use nDVR?

You can configure an application for nDVR and other HTTP clients, as shown in the DVR guide step 3b, here:

https://www.wowza.com/docs/how-to-set-up-and-run-wowza-ndvr-for-live-streaming#config

The StreamTypes are not arbitrary, but you could add one named “netconnection”. The existing StreamTypes are defined in the /conf/Streams.xml file.

Richard

I still don’t understand. onHTTPSessionCreate runs when a HTTP client like an iOS device or Flash HTTP, or Silverlight player starts to play a stream.

Richard

You have to use the HTTP Method to get the “least loaded server”. See the Load Balancer Readme. You can do this in your application server as you are forming html response, or you can do it with javascript XMLHTTPRequest client-side in some cases

Richard

If you are using the Wowza Dynamic Load Balancer, once you find out which edge to connect to you can form a URL that includes the “?DVR” querystring to stream from an edge. If this is just about load balancing and you are using the Wowza load balancer, that is how you do it.

For configuration of DVR for a Liverepeater origin and edges, see this guide:

https://www.wowza.com/docs/how-to-set-up-live-stream-repeater-for-use-with-wowza-ndvr-origin-edge

Richard

dvrrecorder is absent in Application.xml

    <DVR>
      <Recorders></Recorders>
      <Store></Store>
      <StorageDir>${com.wowza.wms.context.VHostConfigHome}/dvr</StorageDir>
      <ArchiveStrategy>append</ArchiveStrategy>
      <Repeater>
        <ChunkOriginURL></ChunkOriginURL>
      </Repeater>
      <Properties>
      </Properties>
    </DVR>

Log:

INFO server comment - Wowza Media Server is started!
INFO server comment - NewBalanceRedirector.onAppStart[redirect/_definst_]: NewBalance init.
INFO application app-start _definst_ redirect/_definst_
INFO server comment - DvrStreamManagerBase.initProperties properties: {Properties: isDvrPacketizer: true}
INFO server comment - DvrStreamManagerBase.initStorage[redirect/_definst_/myStream.stream] : storeName:dvrfilestorage isRecorder:false hasStorage:true
INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: dvrstreamingpacketizer:myStream.stream
WARN server comment - HTTPStreamerAdapterCupertinoStreamer.onManifest: DVR Store not found [redirect/myStream.stream/playlist.m3u8?DVR]: null

dvrstreamingpacketizer is absent in Application.xml

    <Streams>
      <StreamType>netconnection</StreamType>
      <StorageDir>${com.wowza.wms.context.VHostConfigHome}/content</StorageDir>
      <KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir>
      <LiveStreamPacketizers></LiveStreamPacketizers>
      <Properties>
      </Properties>
    </Streams>

Richard,

It does not matter what type I choose. I’ve tried default, live, netconnection.

Could you try the simple test configuration with default Application.xml (as is from conf directory) and run something like

curl -D - http://wowza-server:1935/test/myStream.stream/playlist.m3u8?dvr

?

If URI contains “?dvr”, it will be handled by nDVR even if DVR disabled in the configuration.

In the log you will see the following:

INFO application app-start _definst_ test/_definst_
INFO server comment - DvrStreamManagerBase.initProperties properties: {Properties: isDvrPacketizer: true}
WARN server comment - DvrStreamManagerBase.initStorage[test/_definst_/myStream.stream] : File location '/usr/local/wowza3/dvr/test/_definst_' does not exist for DVR store 'dvrfilestorage'.
INFO server comment - DvrStreamManagerBase.initStorage[test/_definst_/myStream.stream] : storeName:dvrfilestorage isRecorder:false hasStorage:false
INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: dvrstreamingpacketizer:myStream.stream
WARN server comment - HTTPStreamerAdapterCupertinoStreamer.onManifest: DVR Store not found [test/myStream.stream/playlist.m3u8?DVR]: null

IMHO, this is not the correct behavior.

As I wrote in my first post, I have an application with custom module, which provide the redirect to another vhost/application.

This is done with

	public void onHTTPSessionCreate(IHTTPStreamerSession httpSession) {
...
		String queryString = (httpSession.getQueryStr() == null || httpSession.getQueryStr().isEmpty()) ? "" : "?" + httpSession.getQueryStr();
		httpSession.redirectSession(newUri.toString() + queryString);
	}

If requested URI contains “?dvr”, it does not invoke the method onHTTPSessionCreate from the my module.

Yes, I don’t want to use nDVR with this application even when request URI contains “?dvr” querystring. I want invoke httpSession.redirectSession to the new URI with the same querystring.

No, I don’t want to do HTTP live streaming within this application, I want redirect players to another vhost and application.

I need to have custom handling within onHTTPSessionCreate() method. This method is not fired if the “?dvr” handling occurs at the server level, even if it is not mentioned at the application level.

Ok, you use onConnect() method in the your LoadBalancer plugin for redirect RTMP players. (See ModuleLoadBalancerRedirector.java)

How do I redirect the HTTP clients? I implemented a custom method onHTTPSessionCreate(), which does the same for the HTTP clients. And it works fine. For obvious reasons, I need to save querystring untouched when redirect occurs. So, I do copy querystring from the original request to the redirect. And it works fine too. Everything breaks down when the request contains the “?dvr” querystring.

Forgive me for my english. Maybe this is the cause of misunderstanding :confused:

Of course I can do even more within other products, but it is inconvenient.

I need only disable handling of “?dvr” in the application. I hope that you provide a solution without additional javascripts, etc.

Are you trying to use nDVR? I get the impression you want to use ?dvr in your URL but not use the nDVR module.

Yes, I want to pass ?dvr through and not use the nDVR, but in this application only.

Is it possible to have the DVR/Property which tells nDVR: do not process any query as a DVR-request in this application, pass it to HTTPSTreamerSession (onHTTPSessionCreate) untouched?

Falcon-M,

Nevermind, I see you posted it in Post #9. Have you seen onDvrStreamManagerSessionCreate() in the API docs?

Yes, I tried it, but I don’t found a method to bypass nDVR.

randall,

I’m doing the same thing right now, but it looks ugly.

Charlie,

Thank you very much for your detailed reply!

Overall goal is to make an universal application for redirect all types of streaming (rtmp, rtmpt, rtsp, and all of http).

Yes, we are redirecting all URLs that enter this application to a different location and we are redirecting 100% of requests to this application.

This is achieved with something like this:

public class NewBalanceRedirector extends ModuleBase {
...
  public void onConnect(IClient client, RequestFunction function, AMFDataList params) {
    ...
    String queryString = (client.getQueryStr() == null || client.getQueryStr().isEmpty()) ? "" : "?" + client.getQueryStr();
    client.redirectConnection(newUri.toString() + queryString);
  }
  public void onHTTPSessionCreate(IHTTPStreamerSession httpSession) {
    ...
    String queryString = (httpSession.getQueryStr() == null || httpSession.getQueryStr().isEmpty()) ? "" : "?" + httpSession.getQueryStr();
    httpSession.redirectSession(newUri.toString() + queryString);
  }
  public void onRTPSessionCreate(RTPSession rtpSession) {
    ...
    String queryString = (rtpSession.getQueryStr() == null || rtpSession.getQueryStr().isEmpty()) ? "" : "?" + rtpSession.getQueryStr();
    rtpSession.redirectSession(newUri.toString() + queryString);
  }
  ...
}

It works fine under Wowza2 for all modern players and mobile devices!

And then Wowza3 and nDVR has came. Excellent, we were very pleased with this functionality. But we did not expect such “greedy” behavior from the “?dvr”-querystring handler. As do we think, such behavior should not happen if the nDVR is turned off in the application. Because it may have unpredictable consequences in the future.

Your suggestion to use the HTTP provider is reasonable and we already use such providers. But this API (over HTTP) may be unacceptable for the connected TV and some mobile devices. And specifically in this case it is not convenient because it does not cover the RTMP and RTSP streaming. We would like to have one-stop solution like Wowza Media Server :rolleyes:

Thanks again for your wonderful product and excellent support!