Wowza Community

How to disable "?dvr" handling for some application

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!

Remove dvrstreamingpacketizer from LiveStreamPacketizers.

Falcon-M,

Richard has posted the working solution, which is to involve Javascript to form the redirected URI, instead of doing a redirect in a Wowza Module.

I am just curious how you did this, could you post the code that performs the working redirect?

Falcon-M,

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

Falcon-9,

Or maybe you could just alter your code from post #9:

if (queryString = "?1234") queryString = "?DVR";
httpSession.redirectSession(newUri.toString() + queryString);

When you want to start a DVR session on the destination app just open a stream with “?1234” as the query string.

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.

So, you’re saying you want to use ?dvr param but have it do HTTP live streaming if dvr is not enabled?

If that’s the case, that’s not how it works.

Scott

I don’t think we completely understand what you are trying to do.

I understand you want to get the onHTTPSessionCreate when the http session is created. This should work for any type of HTTP Streaming you have enabled (whether vod, live or DVR HTTP streaming).

The ?dvr tells the HTTP Streamer to use dvr instead of the live stream for HTTP streaming.

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

The behavior should be:

If you are using nDVR and it is configured properly, when you send the URL with ?dvr, this will load nDVR and initiate an HTTPSTreamerSession (onHTTPSessionCreate).

If you do not have nDVR turned on, and you send an ?dvr, this will fail to load DVR and no HTTP Session is created. No onHTTPSessionCreate is called.

Scott

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?

Sorry, that is not possible today.