Results 1 to 6 of 6

Thread: How to rewrite requested video file

  1. #1
    Join Date
    Jun 2012
    Posts
    4

    Default How to rewrite requested video file

    I am writing a module that will accept a url that looks like rtsp://localhost/vod/1349218654/67a46696e9438bcdd416618c8be51982/sample_50kbit.3gp. After wowza receives this request there things I do with 1349218654/67a46696e9438bcdd416618c8be51982. What I need is after I have verified 1349218654/67a46696e9438bcdd416618c8be51982 is what it should be it should be stripped out when actually requesting the file itself.


    Right now I get .....

    WARN server comment 67a46696e9438bcdd416618c8be51982/sample_50kbit.3gp MediaReaderH264.open[1]: java.io.FileNotFoundException: /usr/local/WowzaMediaServer/content/67a46696e9438bcdd416618c8be51982/sample_50kbit.3gp (No such file or directory)

    When all I want it to load is /usr/local/WowzaMediaServer/content/sample_50kbit.3gp. It seems that wowza for whatever reason ignores part of it already.

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Take a look at IMediaStreamNameAliasProvider2:

    http://www.wowza.com/forums/content....der2-Interface

    Use resolvePlayAlias(), there are 3 overloads depending on client type.

    Richard

  3. Default

    Also, the reason for wowza ignoring the 1349218654 portion of the URL has to do with how Wowza handles application instances. What that URL tells wowza is, connect to an instance of the VOD application named "1349218654", and then play a file with the path of [content path]/67a46696e9438bcdd416618c8be51982/sample_50kbit.3gp

    If you need both parts of the file path, add an application instance name in your URL, like so:

    rtsp://localhost/vod/_definst_/1349218654/67a46696e9438bcdd416618c8be51982/sample_50kbit.3gp

    In this example, "_definst_" denotes the default instance of the application.

  4. #4
    Join Date
    Jun 2012
    Posts
    4

    Default

    Thank you very much for the info. I was able to get what I wanted with IMediaStreamNameAliasProvider2.

    Is there any way I can force the instance in the app to be _definst_ no matter what is passed? I ask because I am moving from Darwin rtsp and the urls are already being generated this way and we do not want to have to go in and do a rewrite of the urls. My issue now is that every time a new url comes in folders are created in the apps sharedobjects dir. This will get out of hand very fast based on the amount of requests and the fact that no user will ever have the same url.

  5. Default

    I don't think you can get around the instance name, but you can use IApplicationInstance.getName() in your module to retrieve the value you need.

    As for the sharedobjects folder, I don't know if there's any way to tell wowza to not create it unless a sharedobject is requested (perhaps Richard can chime in on that one), but failing that I suppose you could always delete the folder in your onAppStop handler.

  6. #6
    Join Date
    Jun 2012
    Posts
    4

    Default

    Thanks for the reply. I decided to use onAppStop to just remove the folder after being used. This way I dont have to worry about it.

    public void onAppStop(IApplicationInstance appInstance) {

    String fullname = appInstance.getApplication().getName() + "/"
    + appInstance.getName();
    getLogger().info("onAppStop: " + fullname);

    File folder = new File(appInstance.getRsoStoragePath());
    if (folder.exists())
    {
    try
    {
    folder.delete();
    }
    catch (Exception e)
    {
    }
    }
    }

Similar Threads

  1. Alias/Rewrite before Application reaching
    By arturc in forum Server-side Modules and Code Samples Discussion
    Replies: 1
    Last Post: 10-09-2012, 05:14 AM
  2. How to rewrite http request?
    By greenf in forum Server-side Modules and Code Samples Discussion
    Replies: 1
    Last Post: 01-28-2012, 03:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •