Wowza Community

Detect when a stream is ready to be consumed.

Hi,

I am using hls for consuming live stream. and chunk size configured for hls in live app is 10 secs. Also the streams are being transcoded to three streams for adaptive bitrate consumption.

say at t=0 publisher of stream went live. If i click on play button on my player (jwplayer) at t=0 or t=1 (very close to “go live” time) the stream doesnt play properly.

ie i can see 404 being returned from wowza when player asks for manifests for some of the renditions. (rendition1.m3u8 ,rendition2.m3u8). end effect of this is adaptive capability of video player stops working. (since most of the rendition’s manifests calls were 404). sometimes all of the renditions return 404 which results in no video playback.

This issue doesnt happen if i wait for some time before clicking on play button (say t=15 secs ) . My question is is there a way to detect if all the streams are ready to be consumed via hls.

One quick soln that i have is to add some code in onPublish method which signals after a hardcoded delay that stream is live and ready. user’s video player can wait for this signal before making the play button clickable.

Is there a better way to send the above mentioned signal without having to hardcode the delay.

Hi,

You are not able to play back the Apple HLS URL at the same time as the stream is being published on your server, because Wowza needs to packetize that stream into HLS chunks, and depending on your server HLS packetization settings (cupertinoPlaylistChunkCount) that would set the number of chunks to be available in the response to the playlist request that comes from the player.

You can control the time it is required for your stream to be available by changing the duration of one chunk, and the number of chunks that are returned in a chunklist request. In the “How to configure Apple HLS packetization (cupertinostreaming)” forum article you can find useful instructions on how to use these properties.

You should also be able to see when the first Cupertino chunks are created in the Wowza server log files, as the first 10 chunks are logged by default.

Zoran

I am aware of the way hls works. My question is how to detect from code that enough chunks are now available on wowza side . my current approach is to get cupertino packetiser instance from stream instance and check number of chunks available.

IMediaStream stream = appInstance.getStreams().getStream(streamName);

LiveStreamPacketizerCupertino packetiser = (LiveStreamPacketizerCupertino)stream.getLiveStreamPacketizer(“cupertinostreamingpacketizer”);

int numAvalPackets = packetiser.getChunkCount();

But i have to keep on calling this method every 2 secs till i have 2 or 3 chunks ready. Is there a better way to do the above. is there any callback that i can register with packetiser instance which gets called everytime a chunk is created. anything like this is possible ?