How to modify chunk id on hls stream

You can leverage the IHTTPStreamerCupertinoLiveStreamPacketizerChunkIdHandler interface by defining your own custom handler. This can be defined in the LiveStreamPacketizers/Properties element of the Application.xml file. See the following:

<Property>
                <Name>cupertinoChunkIdHandlerClass</Name>
                <Value>guru.thewowza.HLSChunkHandler</Value>
</Property>
package guru.thewowza.HLSChunkHandler;
...
public class HLSChunkHandler extends ModuleBase  {
	public void onAppStart(IApplicationInstance appInstance) {
		appInstance.addLiveStreamPacketizerListener(new LiveStreamPacketizer());
	}
	
	class LiveStreamPacketizer implements ILiveStreamPacketizerActionNotify {

		@Override
		public void onLiveStreamPacketizerCreate(
				ILiveStreamPacketizer liveStreamPacketizer, String streamName) { 
			
		}

		@Override
		public void onLiveStreamPacketizerDestroy(
				ILiveStreamPacketizer liveStreamPacketizer) { 
			
		}

		@Override
		public void onLiveStreamPacketizerInit(
				ILiveStreamPacketizer liveStreamPacketizer, String streamName) {  
			LiveStreamPacketizerCupertino cupertinoPacketizer = (LiveStreamPacketizerCupertino)liveStreamPacketizer;
			cupertinoPacketizer.setChunkIdHandler(new ChunkHandler()); 
		}  
		
	}
	
	class ChunkHandler implements IHTTPStreamerCupertinoLiveStreamPacketizerChunkIdHandler{ 
	
		@Override
		public void init(LiveStreamPacketizerCupertino arg0) {
			 
		}
	
		@Override
		public long onAssignChunkId(
				HTTPStreamerCupertinoLiveStreamPacketizerChunkIdContext arg0) {
			 
			return 0;
		} 
	}
}

Comments are closed.