Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: setPlayStart/setPlayDuration have no effect when called from onHTTPSessionCreate

  1. #1
    Join Date
    Mar 2010
    Posts
    12

    Default setPlayStart/setPlayDuration have no effect when called from onHTTPSessionCreate

    According to the article http://www.wowza.com/forums/content.php?326 one of the methods to specify play start time and duration for HTTP streaming is by using the following Server-side API:

    public void onHTTPSessionCreate(IHTTPStreamerSession httpSession)
    {
    	httpSession.setPlayStart(30000);
    	httpSession.setPlayDuration(40000);
    }
    It does not work in our setup. Instead, it appears that calling setPlayStart() and setPlayDuration() works from resolvePlayAlias().

    Please comment on whether the current behavior of wowza API is correct, or it is a bug that setPlayStart and setPlayDuration may not work in onHTTPSessionCreate, when one uses IMediaStreamNameAliasProvider2.

    In our workflow, we're using resolvePlayAlias from IMediaStreamNameAliasProvider2 to process the requested stream URL, and calculate the proper file location.

    public class CustomStreamNameAlias extends ModuleBase implements IMediaStreamNameAliasProvider2 {
        ...
        public String resolvePlayAlias(IApplicationInstance appInstance, String name, IHTTPStreamerSession httpSession) {
            String filename;
            // some code which calculates the file name and embeds it into the returned value
    
            /*
            // this code appears to work, when uncommented:
            int offset = ...;
            int duration = ...;
            httpSession.setPlayStart(offset);
            httpSession.setPlayDuration(duration);
            getLogger().info("resolvePlayAlias: applied offset="+offset+", duration="+duration);
            */
    
            return name + "#" + filename;
        }
        ...
    }
    then the following code extracts the filename (not sure if it's relevant to this bug):

    public class CustomMediaStreamFileMapper implements IMediaStreamFileMapper {
        ...
        public File streamToFileForRead(IMediaStream stream) {
            String streamname = stream.getName();
            String path = streamname.substring(streamname.lastIndexOf("#") + 1);
            File file = new File(path);
            return file;
        }
        ...
    }
    finally, the implementation of onHTTPSessionCreate:

    public class CustomStreamAccessManager extends ModuleBase {
        ...
        public void onHTTPSessionCreate(IHTTPStreamerSession httpSession)
        {
            boolean isGood = true;
    
            String ipAddressClient = httpSession.getIpAddress();
            String ipAddressServer = httpSession.getServerIp();
            String queryStr = httpSession.getQueryStr();
            String referrer = httpSession.getReferrer();
            String cookieStr = httpSession.getCookieStr();
            String userAgent = httpSession.getUserAgent();
            String streamName = httpSession.getStreamName();
    
            ...
            int offset = ...;
            int duration = ...;
            // the following does not appear to have any effect on the stream:
            httpSession.setPlayStart(offset);
            httpSession.setPlayDuration(duration);
            getLogger().info("onHTTPSessionCreate: applied offset="+offset+", duration="+duration);
            ...
    
            if (!isGood)
                httpSession.rejectSession();
        }
        ...
    }
    The problem which I'm inquiring about is that httpSession.setPlayStart(offset); and httpSession.setPlayDuration(duration); calls inside onHTTPSessionCreate do not have any effect in this setup; but if I uncomment the block in resolvePlayAlias() above, where I do these calls, it appears to work fine. I'd like to know if this is an expected behavior or a bug.

    Please let me know if you need some additional details. The above code is a simplified version of what we're actually using.

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

    Default

    Yes, I get same result. In fact it works without the onHTTPSessionCreate handler, just with the resolvePlayAlias settings.

    Thanks,
    Richard

  3. #3
    Join Date
    Mar 2010
    Posts
    12

    Default

    That's right: calling setPlayStart() and setPlayDuration() works from resolvePlayAlias(), without a onHTTPSessionCreate handler.

    But not vice versa: when I try to use them inside onHTTPSessionCreate, it does not work.

    The article http://www.wowza.com/forums/content.php?326 suggests to use these calls inside onHTTPSessionCreate, so I'd like to know why the method described in the documentation doesn't work.

    I'm able to get the desired functionality, but not via the officially recommended method of calling setPlayStart/setPlayDuration inside onHTTPSessionCreate, and I wonder if it's a bug, or not.

    Is this (non-working setPlayStart/setPlayDuration inside onHTTPSessionCreate) caused by my use of resolvePlayAlias, or the above article should be corrected somehow, to provide a working method?

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

    Default

    Vlad,

    Apply patch 8 which fixes this problem.

    http://www.wowza.com/downloads/Wowza...0.3-patch8.zip

    Thanks for the report,
    Richard

  5. #5
    Join Date
    Mar 2010
    Posts
    12

    Default

    Thank you, I'll try it.

    One question - after applying v3.0.3-patch8, if I'll continue using setPlayStart/setPlayDuration inside resolvePlayAlias, would it be correct? I.e. will it still be "officially supported"? Or it would be better to move such calls to onHTTPSessionCreate?

    And if it works now from onHTTPSessionCreate, does it also work from more specific handlers such as onHTTPCupertinoStreamingSessionCreate?
    Last edited by vlad312; 11-22-2011 at 03:35 PM.

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

    Default

    You can continue to use resolvePlayAlias. onHTTPCupertinoStreamingSessionCreate should work, but will only handle Cupertino, not a catch all that includes Smooth and Sanjose

    Richard

  7. #7
    Join Date
    Mar 2010
    Posts
    12

    Default

    I'd like to confirm that setPlayStart/setPlayDuration work in wowza 3.0.3-patch8 (build965), when called from either resolvePlayAlias or onHTTPSessionCreate (as well as from onHTTPCupertinoStreamingSessionCreate).

    Thank you!

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

    Default

    Did it not work for you?

    Richard

  9. #9
    Join Date
    Mar 2010
    Posts
    12

    Default

    It works! My post #7 is just a confirmation that patch8 fixed the problem.

  10. #10

    Default

    Quote Originally Posted by vlad312 View Post
    It works! My post #7 is just a confirmation that patch8 fixed the problem.
    Is there a documentation about how to extend HTTP Streaming from Wowza?

    I wanna now all the classes that I need to extend to receive an HTTP call e response with the stream.

Page 1 of 4 123 ... LastLast

Similar Threads

  1. MPEG-DASH and setPlayStart() setPlayDuration() not working
    By Vizibirka in forum Wowza Streaming Server Java API
    Replies: 7
    Last Post: 05-29-2014, 10:33 AM
  2. In Android the onHTTPSessionCreate method is called 3 times
    By magnesiosl85 in forum General Forum
    Replies: 1
    Last Post: 11-07-2013, 02:44 PM
  3. Stream not found before onHTTPSessionCreate
    By Renato@Voitel in forum General Forum
    Replies: 2
    Last Post: 06-19-2013, 08:06 AM
  4. onHTTPSessionCreate does not trigger
    By Roy0817 in forum General Forum
    Replies: 16
    Last Post: 05-03-2013, 06:29 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
  •