Specify a play start time and duration for HTTP streaming with Wowza Streaming Engine

You can play part of an on-demand file when streaming using the HTTP streaming protocols (Adobe HDS, Apple HLS, MPEG-DASH, and Microsoft Smooth Streaming). This article describes different methods for specifying the start time and duration in Wowza Streaming Engine™ media server software.


Specify start time and duration in URL query parameters


All HTTP streaming protocols support the wowzaplaystart and wowzaplayduration query parameters. The time values are specified in milliseconds. The following examples show how to use these query parameters in URLs to play the sample.mp4 video file in your Wowza media server installation, starting at 30 seconds for a duration of 40 seconds.

Adobe HDS

 
http://[wowza-ip-address]:1935/vod/mp4:sample.mp4/manifest.f4m?wowzaplaystart=30000&wowzaplayduration=40000

Apple HLS

 
http://[wowza-ip-address]:1935/vod/mp4:sample.mp4/playlist.m3u8?wowzaplaystart=30000&wowzaplayduration=40000

MPEG-DASH

 
http://[wowza-ip-address]:1935/vod/mp4:sample.mp4/manifest.mpd?wowzaplaystart=30000&wowzaplayduration=40000

Smooth Streaming

 
http://[wowza-ip-address]:1935/vod/mp4:sample.mp4/Manifest?wowzaplaystart=30000&wowzaplayduration=40000
Note:To use the query string method with Silverlight, you may need to use the escape code for the & character in the URL. For example:
http://[wowza-ip-address]:1935/vod/mp4:sample.mp4/Manifest?wowzaplaystart=30000&wowzaplayduration=40000

Specify start time and duration in SMIL files


In SMIL files, use the begin and dur attributes. The time values for these attributes are specified in seconds:

<smil>
	<head>
	</head>
	<body>
		<switch>
			<video begin="30.0" dur="40.0" src="mp4:sample.mp4" system-bitrate="450000"/>
		</switch>
	</body>
</smil>

Specify start time and duration by using an HTTP streamer session


You can specify the playStart and playDuration times through an IHTTPStreamerSession session. The time values are specified in milliseconds. For example, you can use the following method in a module:

public void onHTTPSessionCreate(IHTTPStreamerSession httpSession)
{
	httpSession.setPlayStart(30000);
	httpSession.setPlayDuration(40000);
}

Specify start time and duration by using the MediaList API


The time values are specified in milliseconds:

public class ModuleAMLSTTest extends ModuleBase implements IMediaListProvider
{
	public void onAppStart(IApplicationInstance appInstance)
	{
		appInstance.setMediaListProvider(this);
	}

	public MediaList resolveMediaList(IMediaListReader mediaListReader, IMediaStream stream, String streamName)
	{
		MediaList mediaList = new MediaList();

		MediaListSegment segment = new MediaListSegment();
		mediaList.addSegment(segment);

		MediaListRendition rendition1 = new MediaListRendition();
		segment.addRendition(rendition1);

		rendition1.setName("mp4:sample.mp4");
		rendition1.setBitrateAudio(128000);
		rendition1.setBitrateVideo(400000);
		rendition1.setWidth(320);
		rendition1.setHeight(240);
		rendition1.setPlayStart(30000);
		rendition1.setPlayDuration(40000);

		return mediaList;
	}
}