Results 1 to 3 of 3

Thread: Short term (10 sec) Timeshift Delay - PushPublish

  1. #1
    Join Date
    Sep 2011
    Posts
    10

    Default Short term (10 sec) Timeshift Delay - PushPublish

    Hello

    I have an encoder pushing to a wowza, which then uses pushpublish to publish to a CDN.

    What I wish to do is set a timedelay (by 10 or so seconds) between the incoming stream and the stream that is being pushed to the CDN in order to allow an "operator" to connect and view the incoming stream directly, the Operator can then insert cue points which will be embedded into the outgoing stream.

    The reason for the timedelay is that some cue points which will be injected have to be injected approx 5 seconds before the frame that is shown to the operator at that time from the input stream. Since the output stream will be 10 sec in the past, it should therefore be able to inject the cue point at the correct time.

    Can this be done on a wowza?

    Ideally I would prefer to simply duplicate the stream, and have a method that reads the input stream packets as they occur, and writes them to a local buffer, it then writes the packets from that buffer into the duplicated stream but only if there are more then 10 seconds worth of packets in the buffer.

    Regards,
    Evgeny

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

    Default

    Evgeny,

    See if this helps:
    http://www.wowza.com/downloads/forum...hWithDelay.zip

    Richard

  3. #3
    Join Date
    Sep 2011
    Posts
    10

    Default

    Thanks Richard, This is exactly what I'm after, but It doesnt appear to be working when I publish from my encoder.

    I've managed to get the embedded test swf pulling from my webcam to work correctly, however when I try to publish from my encoder, the testingDelay connects but no video or audio comes through (I did initiate the delay republish and the testingDelay stream was getting published). This seems to resemble the same behaviour that I had previously experienced where the audio and video header packets were not embedded, could it be the case that these header packets are not being embedded into the republished stream?

    To simplify things I have used the following automated approach for Delayed stream generation:
    package com.wowza.wms.plugin.publishwithdelay;
    
    import java.util.*;
    import com.wowza.wms.media.model.MediaCodecInfoAudio;
    import com.wowza.wms.media.model.MediaCodecInfoVideo;
    import com.wowza.wms.module.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.request.*;
    import com.wowza.wms.stream.IMediaStream;
    import com.wowza.wms.stream.IMediaStreamActionNotify3;
    import com.wowza.wms.amf.*;
    
    public class ModulePublishWithDelay extends ModuleBase
    {
    	Map<String, PublishWithDelayWorker> delayPublishers = new HashMap<String, PublishWithDelayWorker>();
    	
    	
    	class StreamNotify implements IMediaStreamActionNotify3 {
    
    		public void onPlay(IMediaStream stream, String streamName,
    				double playStart, double playLen, int playReset) {
    		}
    
    		public void onPause(IMediaStream stream, boolean isPause,
    				double location) {
    		}
    
    		public void onSeek(IMediaStream stream, double location) {
    		}
    
    		public void onStop(IMediaStream stream) {
    		}
    
    		public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket) {
    		}
    
    		public void onPauseRaw(IMediaStream stream, boolean isPause,
    				double location) {
    		}
    
    		public void onPublish(IMediaStream stream, String streamName,
    				boolean isRecord, boolean isAppend) {
    
    			
    			String srcStreamName = streamName;
    			String dstStreamName = streamName+"Delay";
    			int delay = (int)10000;
    			
    			PublishWithDelayWorker worker = new PublishWithDelayWorker(stream.getStreams().getAppInstance(), srcStreamName, dstStreamName);
    			worker.setDelay(delay);
    			
    			getLogger().info("startDelayPublisher");
    			getLogger().info("  srcStreamName: "+srcStreamName);
    			getLogger().info("  dstStreamName: "+dstStreamName);
    			getLogger().info("  delay: "+delay);
    			
    			synchronized (delayPublishers)
    			{
    				delayPublishers.put(srcStreamName, worker);
    			}
    			
    			worker.setDaemon(true);
    			worker.start();
    			
    
    		}
    
    		public void onUnPublish(IMediaStream stream, String streamName,
    				boolean isRecord, boolean isAppend) {
    		}
    
    		public void onCodecInfoAudio(IMediaStream arg0, MediaCodecInfoAudio arg1) {
    
    			
    		}
    
    		public void onCodecInfoVideo(IMediaStream arg0, MediaCodecInfoVideo arg1) {
    			
    		}
    
    	}
    	
    	public void onStreamCreate(IMediaStream stream) {
    		stream.addClientListener(new StreamNotify());
    	}
    
    	public void onStreamDestory(IMediaStream stream) {
    	}
    	
    	
    
    }

Similar Threads

  1. Delay 10 sec after server get first Packet
    By seanlin0324 in forum Live Streaming and Encoder Discussion
    Replies: 4
    Last Post: 01-22-2014, 08:28 PM

Posting Permissions

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