Use the API to push publish hls to Akamai

This snippet below can be used to programmatically send a stream to the Akamai via HLS.

// Within an onPublish event where stream and streamName are obtained from the parameter set.
IApplicationInstance appInstance = stream.getStreams().getAppInstance();

// Destination stream  
String outboundStreamName = "[YOUR-AKAMAI-STREAM-NAME]"; 
String akamaiHostId = "[YOUR-AKAMAI-HOST-ID]";   
String akamaiStreamID = "[YOUR-AKAMAI-ID]"; 
String groupName = "group2";
String event = "test"; 
 
PushPublishHTTPCupertinoAkamai publisher = new PushPublishHTTPCupertinoAkamai();
publisher.setPlaylistCountFromPacketizer(10);
publisher.setRedundant(true);
publisher.setAdaptiveStreaming(true); 
publisher.setPlaylistAcrossSessions(true);   
publisher.setRenditions(PushPublishHTTPCupertinoAkamai.RENDITION_AUDIOVIDEO);
publisher.setAkamaiStreamId(akamaiStreamID); 
publisher.addAdaptiveGroupItem(groupName);
publisher.setAkamaiHostId(akamaiHostId);
publisher.setSrcStreamName(streamName);
publisher.setAkamaiEventName(event); 
publisher.setDstStreamName(outboundStreamName); 
//publisher.setDebugLog(true);     

// akamaiProtocolName doesn't seem to get assigned without leveraging this method (alas no public facing function to assign this)
publisher.init(appInstance, streamName, stream, new HashMap(), new HashMap(), true);

// now connect
publisher.connect(); 

Comments are closed.