Results 1 to 7 of 7

Thread: limiting duration of stream on server side

  1. #1
    Join Date
    Mar 2010
    Posts
    23

    Default limiting duration of stream on server side

    Hi,

    i'm interested in a way to limit duration of stream of static (on demand) files on server side.

    i found some pages on this forum which touch this problem, but not sure if there's a working solution:

    http://www.wowzamedia.com/forums/showthread.php?t=5710
    http://www.wowzamedia.com/forums/showthread.php?t=5545
    http://www.wowzamedia.com/forums/showthread.php?t=1864
    http://www.wowzamedia.com/forums/showthread.php?t=1194
    http://www.wowzamedia.com/forums/showthread.php?t=349

    features i need are:

    * this applies to streaming static files on demand

    * media may have long duration, but i need to enforce streaming to the specified portion of the file (start, duration)

    * i cannot rely on client side player to select the start and duration, but need to enforce this on server side

    * seeking should be allowed only within the allowed portion of the file (but again this check should be enforced on server side)

    i.e., suppose that I have some 10-minute static media file. i'd like to make it so that when client requests playback, it gets to see only a 1-minute portion of this file, starting from 3rd minute from the beginning of the file. client should not be able to listen any portion of the file outside of this range.

    is this possible? thanks in advance for your help!

    maybe it is possible to achieve using the server-side SMIL playlists?
    Last edited by vlad312; 04-27-2010 at 06:00 AM.

  2. #2
    Join Date
    Dec 2007
    Posts
    25,640

    Default

    Part of this is easy, but if you don't have control of the client you are going to have some issues with the seek bar. Most clients use the duration returned in the metadata to set the length of the seek bar length.

    Code:
    package com.wowza.wms.example.module;
    
    import com.wowza.wms.module.*;
    import com.wowza.wms.amf.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.request.*;
    
    public class ModuleOverridePlayExample extends ModuleBase {
    	
    	public void play(IClient client, RequestFunction function,
    	    AMFDataList params) {
    		
    		AMFDataList customDataList = new AMFDataList();
            customDataList.add("play");
            customDataList.add(0.0);
            customDataList.add("null");
            customDataList.add(params.getString(PARAM1));
            customDataList.add(new AMFDataItem(5000)); //start 5 seconds from the beginning
            customDataList.add(new AMFDataItem(10000)); // play for 10 seconds
            customDataList.add(new AMFDataItem(true));
    
            ModuleCore.play(client, function, customDataList);		
    		}
    }
    Richard

  3. #3
    Join Date
    Mar 2010
    Posts
    23

    Default

    Richard, thank you very much for reply.

    i found similar solution which you recommended to others, e.g. here:
    http://www.wowzamedia.com/forums/showthread.php?t=6015

    i'll try it. will it prevent from seeking on client side outside the allowed range?

    also, is it possible to override the metadata sent to client so that client will see proper duration?

  4. #4
    Join Date
    Dec 2007
    Posts
    25,640

    Default

    What should happen, what does happen with the SimpleVideoStreaming Flex example that I tested with, is the scrubber will be scaled for the full duration of the video, but the user won't be able to seek outside your parameters. However it is highly imperfect because much of the seek bar will just do nothing.

    If you have control of the client there are ways to fix it. Basically you can setup a server-side function to return the correct length to the client and scale the seek bar to that value instead of the duration value in the metadata object.

    Richard

  5. #5

    Default

    Hello Richard.

    I'm doing a module to authenticate via Mysql and I need for not authorized users stream only 20 seconds of the video,
    and for authorized - the full video.

    Code:
            customDataList.add(new AMFDataItem(5000)); //start 5 seconds from the beginning
            customDataList.add(new AMFDataItem(10000)); // play for 10 seconds
    What I need to write in a 'Play' method to play the full video?
    I apologize for the noob questions :)

    Thank you
    Last edited by Yuri!!; 05-07-2013 at 08:48 AM.

  6. #6
    Join Date
    Dec 2007
    Posts
    25,640

    Default

    Make the start value "0" and the length "-1"
    Code:
    customDataList.add(new AMFDataItem(0)); //start at the beginning
    customDataList.add(new AMFDataItem(-1)); // play to the end
    Richard

  7. #7

    Default

    Great thanks !

Tags for this Thread

Posting Permissions

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