Results 1 to 10 of 10

Thread: Determine install directory from HTTPProvider?

  1. #1

    Default Determine install directory from HTTPProvider?

    I have an HTTPProvider that needs to load a file from the conf directory. When I debug from Eclipse the current working directory is not the Wowza install directory. Is there a call I can make to determine the location of the Wowza install?

    Also I will be using the mediacaster routines to start and stop a stream as shown in the example HTTPProvider. However, I have streams that start up on demand using mediacaster's "rtp-live" and would like to be able to dynamically make them inaccessible just like stopping the mediacaster "rtp" streams. Any advice on the best way to do this? The purpose of my HTTPProvider is to make a custom web page of all streams and control their access.

    JohnA

  2. #2
    Join Date
    May 2013
    Posts
    680

    Default

    Hello JohnA

    To obtain the filepath to your conf directory, you might try the following:
    Bootstrap.getServerHome(Bootstrap.CONFIGHOME) + "/conf/"
    As per your second question, it sounds like you might want to take a look at our ban stream server listener from within our Module Collection. This should allow you to make these streams inaccessible. Just setup the listener as follows in your Server.xml:
    <ServerListener>
            <BaseClass>com.wowza.wms.plugin.collection.serverlistener.ServerListenerBanStreams</BaseClass>
    </ServerListener>

  3. #3

    Default

    Thanks for the info Matt. I'll check out the module collection.

    JohnA

  4. #4
    Join Date
    May 2013
    Posts
    680

    Default

    Hey JohnA,

    You are welcome. That server listener resides in the actual collection (you'll see when you download it) but hasn't made it onto the list shown on the module collection page as of yet.

    Matt

  5. #5

    Default

    Found it in the Java source.

  6. #6

    Default

    Tried using the ban to prevent access to a mediacaster "rtp" stream and it didn't work. The stream does appear in the blacklist.txt file as...

    live:_definst_:entrance.stream

    The application name is "live". Not sure what the meaning of application instance is, but _definst_ seems to be used in the examples I've seen. And the stream name is entrance.stream.

    Does "ban" not work on a stream that is running in the mediacaster? I know you suggested ban for mediacaster "rtp-live", but it seemed simple if I could use it for both. I haven't tried it on "rtp-live" yet.

    Even restarting the server didn't have an effect. And I need to do this dynamically anyway.

    JohnA

  7. #7

    Default

    Hi John,

    The Ban Streams server listener currently only shuts down player streams that are running at the time they are banned. It doesn't check to see if they are banned when a player reconnects because it also shuts down the published stream from the encoder. Unfortunately, this doesn't work for mediaCaster streams that are started dynamically.

    The following class will check to see if the stream name is banned when the player connects and will prevent it from starting a mediaCaster if it is.

    	class StreamAliasProvider implements IMediaStreamNameAliasProvider
    	{
    
    		@Override
    		public String resolvePlayAlias(IApplicationInstance appInstance, String name)
    		{
    			if (BlackListUtils.isStreamBlackListed(appInstance.getApplication().getName(), appInstance.getName(), name))
    				return null;
    			return name;
    		}
    
    		@Override
    		public String resolveStreamAlias(IApplicationInstance appInstance, String name)
    		{
    			return MediaCasterUtils.handleStreamAliasFile(appInstance, name);
    		}
    
    	}
    Add it as a sub class to the ServerListenerBanStreams class and invoke it from the ApplicationInstanceNotify.onApplicationInstanceCreate method.
    		public void onApplicationInstanceCreate(IApplicationInstance appInstance)
    		{
    			if (ServerListenerBanStreams.debug)
    			{
    				logger.info(MODULE_NAME + ".onApplicationInstanceCreate[" + appInstance.getName() + "] Stream Listener is initiated");
    			}
    
    			appInstance.setStreamNameAliasProvider(new StreamAliasProvider());
    			appInstance.addMediaStreamListener(listener);
    		}
    It works by returning null from the resolvePlayAlias method if the stream is banned. When null is returned from this method, a 404 response is sent back to the player. The resolveStreamAlias method calls the internal stream files handler so these will still work.

    Note: You can only have one StreamNameAliasProvider for an appInstance. If there are multiple ones in different modules then the last one loaded will override the rest.

    The onApplicationInstanceCreate method gets called after any onAppStart module methods so will override those. If you already have a alias provider in a module then it would be best to do the ban check there. It is a static method so can be called from anywhere.

    Roger.

  8. #8

    Default

    I have the WowzaServerAddOnCollection_4.0 imported into Eclipse to make the mods. I put the WowzaServerAddOnCollection_4.0 directory in my "workspace" folder where my custom HTTPProvider is located. If I load it as an existing project it has a bunch of errors because it doesn't know the location of any of the Wowza jars. So I add them as external jars and everything is fine except it can't find either of these two imports....

    import com.wowza.wms.plugin.loadbalancer.LoadBalancerSender;
    import com.wowza.wms.plugin.loadbalancer.ServerListenerLoadBalancerSender;

    Any idea where this is?

    EDIT: I found the LoadBalancer_2.0.zip file and put the jar in my Wowza lib folder.
    Last edited by fly135; 08-26-2014 at 01:35 PM.

  9. #9

    Default

    Quote Originally Posted by roger_l View Post
    The Ban Streams server listener currently only shuts down player streams that are running at the time they are banned. It doesn't check to see if they are banned when a player reconnects because it also shuts down the published stream from the encoder. Unfortunately, this doesn't work for mediaCaster streams that are started dynamically.

    The following class will check to see if the stream name is banned when the player connects and will prevent it from starting a mediaCaster if it is.
    Roger, I have implemented all of your suggestions and here are my remaining issue....

    When banning an "rtp-live" stream, when the stream is currently being viewed the current viewer is not prohibited from viewing the stream. IOW the stream is not stopped. I'm even calling the mediacaster and issuing a stop but it's of no consequence.

  10. #10
    Join Date
    May 2013
    Posts
    680

    Default

    Hello

    Please restart Wowza and reproduce this issue and then zip up your conf/ and logs/ directories and send them to support@wowza.com.

    Thanks,

    Matt

Similar Threads

  1. Best way to determine AppType
    By AlexeyTs in forum Wowza Streaming Server Java API
    Replies: 1
    Last Post: 07-30-2014, 05:39 AM
  2. Determine when a stream was published
    By bosborne in forum Server-side Modules and Code Samples Discussion
    Replies: 3
    Last Post: 03-18-2013, 09:56 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
  •