Is it possible to add alternate (backup) streams to an HLS manifests in Wowza when using the Java API to generate the dynamic playlist (AMLST).
I have a code like this where I add dynamically the different bitrates, but I would like to add one backup stream. (I tried adding a second MediaListSegment but it does not seem to work).
package com.wowza.wms.plugin.test.module;
import com.wowza.wms.medialist.*;
import com.wowza.wms.module.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.application.*;
public class ModuleAMLSTTestLive extends ModuleBase
{
class MyMediaListProvider implements IMediaListProvider
{
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(streamName+"_400");
rendition1.setBitrateAudio(128000);
rendition1.setBitrateVideo(400000);
rendition1.setWidth(320);
rendition1.setHeight(240);
rendition1.setAudioCodecId("mp4a.40.2");
rendition1.setVideoCodecId("avc1.66.12");
MediaListRendition rendition2 = new MediaListRendition();
segment.addRendition(rendition2);
rendition2.setName(streamName+"_800");
rendition2.setBitrateAudio(128000);
rendition2.setBitrateVideo(800000);
rendition2.setWidth(640);
rendition2.setHeight(480);
rendition2.setAudioCodecId("mp4a.40.2");
rendition2.setVideoCodecId("avc1.77.31");
return mediaList;
}
}
public void onAppStart(IApplicationInstance appInstance)
{
appInstance.setMediaListProvider(new MyMediaListProvider());
}
}
Although this is not supported in the API, I finally found a solution:
It is possible to define main and backup streams by specifing the streams with the absolute path of the stream in the URI or DOMAIN cupertino tags.
Sample smil:
<body>
<switch>
<video src="mp4:foo.mp4" system-bitrate="300000">
<param name="videoCodecId" value="avc1.66.30" valuetype="data"/>
<param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
<param name="cupertinoTag.URI" value="http://serverwowza1.foo.com:1935/vod/mp4:foo.mp4/chunklist.m3u8" valuetype="data"/>
</video>
<video src="mp4:foo.mp4" system-bitrate="300000" >
<param name="videoCodecId" value="avc1.66.30" valuetype="data"/>
<param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
<param name="cupertinoTag.URI" value="http://serverwowza2.foo.com:1935/vod/mp4:sample.mp4/chunklist.m3u8" valuetype="data"/>
</video>
...