Class MediaTransportConfigurationAmazonS3

Object
com.wowza.wms.transport.media.MediaTransportConfigurationBase
com.wowza.wms.transport.media.MediaTransportConfigurationAmazonS3
All Implemented Interfaces:
IMediaTransportProviderConfiguration

public class MediaTransportConfigurationAmazonS3 extends com.wowza.wms.transport.media.MediaTransportConfigurationBase
This is a base configuration object for AmazonS3 for the MediaTransport System //Example use

//Create a main transport object

MediaTransport transport = new MediaTransport();

//Create an Amazon Transport Provider
MediaTransportProviderAmazonS3 amazonTransport = new MediaTransportProviderAmazonS3();

//Create an Amazon Configuration Object
MediaTransportConfigurationAmazonS3 amazonConfig = new MediaTransportConfigurationAmazonS3();

//Configure the Amazon object with the required parameters
amazonConfig.setAttributeString(MediaTransportConfigurationAmazonS3.AMZ_CONFIG_BUCKET, "mybucketName");
amazonConfig.setAttributeString(MediaTransportConfigurationAmazonS3.AMZ_CONFIG_REGION, "bucketRegionName");
amazonConfig.setAttributeBoolean(MediaTransportConfigurationAmazonS3.AMZ_CONFIG_REGION_ENABLED, true);
amazonConfig.setAttributeString(MediaTransportConfigurationAmazonS3.AMZ_CONFIG_ACCESSID, "myAmazonAccessKey");
amazonConfig.setAttributeString(MediaTransportConfigurationAmazonS3.AMZ_CONFIG_SECRETACCESSKEY, "myAmazonSecretKey");

//Add the configuration item to the provider
amazonTransport.setTransportProviderConfiguration(amazonConfig);

//Set the type of processing to occur, the default is ASYNC, set to SYNC
//Async will use a thread pool to handle transports, SYNC will block and do them in the order
//they are provided
amazonTransport.setTransportProcessType(IMediaTransportProvider.TRANSPORT_PROVIDER_PROCESS_SYNC);

//Initialize the provider
amazonTransport.init();

//Add the transport provided to the media transport system
transport.addTransportProvider(amazonTransport);

//You can add multiple transport providers

//To push a data block into the transport system the following example should be followed

//Lets assume you have a byte array, say from loading a file into this array.
byte[] fileBytes = getBytesFromFile(uploadFile);

//Create a data object and set up various settings.
MediaTransportDataObject transportDataObject = new MediaTransportDataObject();
transportDataObject.setPath("/"+filename);
transportDataObject.setContentType("video/mp4");
transportDataObject.setData(fileBytes);
transportDataObject.setCommand("PUT");

//Put the object into the transport system
trasnport.addTransportDataObject(transportDataObject);

// There are several listeners you can use to determine if the transport provider was added
// and the return status of the object presented to the system.
  • Field Details

  • Constructor Details

    • MediaTransportConfigurationAmazonS3

      public MediaTransportConfigurationAmazonS3()
  • Method Details

    • init

      public void init()
      Description copied from interface: IMediaTransportProviderConfiguration
      Initialise the provider configuration. This should only be called when all appropriate attributes have been set.
      Specified by:
      init in interface IMediaTransportProviderConfiguration
      Overrides:
      init in class com.wowza.wms.transport.media.MediaTransportConfigurationBase
    • expandUrlTemplate

      public static String expandUrlTemplate(String urlTemplate, String bucketName, String region, String serviceType, String domainSuffix)
      Validates and expands an S3 urlTemplate (host[:port][/path], no scheme). Only ${bucketName}, ${region}, ${serviceType} and ${domainSuffix} are expanded; a trailing '/' is removed.
      Throws:
      IllegalArgumentException - if the template is invalid or a variable it uses is empty
    • isValidHostAndPort

      public static boolean isValidHostAndPort(String value)
      True if value is host or host:port: a DNS name or IPv4 address (letters, digits, '_' and '-' labels separated by '.'), or a bracketed IPv6 literal, with an optional port of 1-65535.
    • getTransportHeaderOutput

      public HashMap<String,String> getTransportHeaderOutput(HashMap<String,byte[]> dynamictransportinformation, IMediaTransportObject transportObject)
      Description copied from interface: IMediaTransportProviderConfiguration
      This should be called by the transport provider using this configuration item. You can pass in two objects, one is a HashMap<String,byte[]> and the other is a IMediaTransportObject The result should be a HashMap<String,String> that the transport provider can then use to process the data block being transported.
      Specified by:
      getTransportHeaderOutput in interface IMediaTransportProviderConfiguration
      Overrides:
      getTransportHeaderOutput in class com.wowza.wms.transport.media.MediaTransportConfigurationBase
      Returns:
      HashMap<String,String>