Results 1 to 6 of 6

Thread: uniform way to log stream events for different streams

  1. #1
    Join Date
    May 2012
    Posts
    8

    Default uniform way to log stream events for different streams

    Is there an abstraction layer that programmers can use to capture events like onPlay for any kind of stream (RTMPT/Smooth/Cupertino/etc)? Or do i have to write the same code for all streams (but adapated to those streams)?

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

    Default

    There is one for HTTP session create and destroy that covers cupertino, smooth and sanjose
    http://www.wowza.com/forums/content....josestreaming)

    RTSP is handled separately
    http://www.wowza.com/forums/content....TSP-RTP-stream

    For RTMP you can override play
    http://www.wowza.com/forums/content....control-access

    Or for RTMP you can use the IMediaStreamActionNotify3.onPlay()
    http://www.wowza.com/forums/content....es-codec-info)

    Of course RTMP has to connect first, so you can also use onConnect to do thing in that case. There is no stream associated with the connection at that point.

    Richard

  3. #3
    Join Date
    May 2012
    Posts
    8

    Default

    So basically, this is what i'd have to do:

    import com.wowza.wms.httpstreamer.model.IHTTPStreamerSession;
    import com.wowza.wms.amf.*;
    import com.wowza.wms.application.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.stream.*;
    import com.wowza.wms.media.model.*;
    
    
    public class CustomModule extends ModuleBase
    {
    
    	class StreamListener implements IMediaStreamActionNotify3
    	{
    		public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset)
    		{
    			customLogObject("onPlay got triggered");
    		}
    	}
    
    	// set rtmp listener to capture onPlay event
    	public void onStreamCreate(IMediaStream stream)
    	{
    		getLogger().info("onStreamCreate["+stream+"]: clientId:" + stream.getClientId());
    		IMediaStreamActionNotify2 actionNotify = new StreamListener();
    
    		WMSProperties props = stream.getProperties();
    		synchronized (props)
    		{
    			props.put("streamActionNotifier", actionNotify);
    		}
    		stream.addClientListener(actionNotify);
    	}
    
    	// capture creation of a (cupertino) stream
    	public void onHTTPSessionCreate(IHTTPStreamerSession httpSession)
    	{
    		customLogObject("streamCreate got triggered");
    	}
    }
    In the streamlistener i can capture onplay, onpause, onstop, onseek, etc... this way i can also try to determine for howlong a user has been listening to a stream.
    Have i understood it correctly that for cupertino i can only determine when an audiostream was started (using onHTTPSessionCreate) and when it was stopped (using onHTTPSessionDestroy)? So, if a user pauses the audio, i have no way of determining this for cupertino streams?

  4. #4
    Join Date
    May 2012
    Posts
    8

    Default

    I've been experimenting a little and it seems onHTTPSessionCreate seems to provide the means to capture the idea of 'onPlay'. I would also like to capture the onStop and onPause though and have the following problems:
    - I've created an onHTTPSessionDestroy. But this gets triggered roughly half a minute after i've pressed the stop button. At this point httpSession.getPlayDuration() results in -1 and httpSession.getTimeRunningSeconds() includes this half a minute. How can i accurately determine for how long the user has been listening to the audio (or watching the video, but it's just audio in my case)
    - I can't seem to find an alternative for onPause: is this possible for the http cupertino streams?

  5. #5
    Join Date
    Sep 2011
    Posts
    1,934

    Default

    Hi
    You can't record a "pause" with cupertino streaming, the way that it gets the data is through chunks and it stops getting chunks if you pause the stream.
    There is also no way of recording when the stop button is activated either, it simply has a timeout limit between chunks so if the timeout is exceeded it assumes that you have stopped watching and destroys the stream, so pausing for more than this time will also destroy the stream.

    Jason

  6. #6

    Default

    theMarty,

    Since you build your player in HTML5 for iOS devices, you can have your play/pause button post to HTTPProvider form on the server, in order to log these events.

Similar Threads

  1. IMediaCasterNotify2 vs PushPublish - no events on published streams
    By AlexeyTs in forum Server-side Modules and Code Samples Discussion
    Replies: 3
    Last Post: 01-07-2014, 05:45 PM
  2. How to listen for log events from Wowza
    By GraemeBull in forum General Forum
    Replies: 2
    Last Post: 01-15-2013, 01:50 PM
  3. Handle Cupertino Streams play, seek events
    By herkules in forum Video On Demand Streaming Discussion
    Replies: 4
    Last Post: 01-23-2012, 09:03 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
  •