Esempio n. 1
0
        private IChannel CreateChannel(string channelName, ChannelEncodingType channelType, StreamingProtocol ingestProtocol)
        {
            ChannelCreationOptions creationOptions = new ChannelCreationOptions();

            creationOptions.Name         = channelName;
            creationOptions.EncodingType = channelType;

            IPRange allAddresses = new IPRange();

            allAddresses.Address            = new IPAddress(0);
            allAddresses.Name               = Constants.Media.Stream.AddressRangeAll;
            allAddresses.SubnetPrefixLength = 0;

            creationOptions.Input = new ChannelInput();
            creationOptions.Input.AccessControl             = new ChannelAccessControl();
            creationOptions.Input.AccessControl.IPAllowList = new List <IPRange>();
            creationOptions.Input.AccessControl.IPAllowList.Add(allAddresses);
            creationOptions.Input.StreamingProtocol = ingestProtocol;

            creationOptions.Preview = new ChannelPreview();
            creationOptions.Preview.AccessControl             = new ChannelAccessControl();
            creationOptions.Preview.AccessControl.IPAllowList = new List <IPRange>();
            creationOptions.Preview.AccessControl.IPAllowList.Add(allAddresses);

            IChannel channel = _media.Channels.Create(creationOptions);

            CreateProgram(channel);
            return(channel);
        }
Esempio n. 2
0
        public void CreateChannel(string channelName)
        {
            ChannelEncodingType channelType    = ChannelEncodingType.None;
            StreamingProtocol   ingestProtocol = StreamingProtocol.RTMP;
            IChannel            channel        = CreateChannel(channelName, channelType, ingestProtocol);

            foreach (IProgram program in channel.Programs)
            {
                CreateLocator(null, LocatorType.OnDemandOrigin, program.Asset, null);
            }
        }
Esempio n. 3
0
 static ChannelEncoding MakeChannelEncoding(ChannelEncodingType encodingType)
 {
     return(new ChannelEncoding
     {
         SystemPreset = encodingType == ChannelEncodingType.Standard ? "Default720p" : "Default1080p",
         IgnoreCea708ClosedCaptions = false,
         AdMarkerSource = AdMarkerSource.Api,
         AudioStreams = new List <AudioStream> {
             new AudioStream {
                 Index = 103, Language = "eng"
             }
         }.AsReadOnly()
     });
 }
Esempio n. 4
0
        public string CreateChannel(string channelName, MediaEncoding channelEncoding, MediaProtocol inputProtocol,
                                    string inputAddressAuthorized, int?inputSubnetPrefixLength,
                                    string previewAddressAuthorized, int?previewSubnetPrefixLength,
                                    int?archiveWindowMinutes, bool archiveEncryption)
        {
            ChannelEncodingType channelType     = (ChannelEncodingType)channelEncoding;
            StreamingProtocol   channelProtocol = (StreamingProtocol)inputProtocol;
            IChannel            channel         = CreateChannel(channelName, channelType, channelProtocol, inputAddressAuthorized, inputSubnetPrefixLength, previewAddressAuthorized, previewSubnetPrefixLength);

            CreatePrograms(channel, archiveWindowMinutes, archiveEncryption);
            foreach (IProgram program in channel.Programs)
            {
                CreateLocator(LocatorType.OnDemandOrigin, program.Asset);
            }
            return(channel.Id);
        }
 public static ChannelCreationOptions CreateNewChannelOptions(
     string name,
     ChannelEncodingType encodingType,
     StreamingProtocol protocol,
     string encodingPreset,
     string slateAssetId
     )
 {
     return(new ChannelCreationOptions
     {
         Name = string.Format("New-Channel-{0}", DateTime.UtcNow.ToOADate().ToString().Replace(".", "-")),
         Description = "Newly Created Channel",
         EncodingType = encodingType,
         Input = ConfigureDefaultInput(protocol, GetDefaultIpAllowList()),
         Preview = ConfigureChannelPreview(null),
         Output = new ChannelOutput(),
         Encoding = encodingType != ChannelEncodingType.None ? GetDefaultEncoding(encodingPreset) : null,
         Slate = encodingType != ChannelEncodingType.None ? GetDefaultSlate(slateAssetId) : null
     });
 }
Esempio n. 6
0
        private IChannel CreateChannel(string channelName, ChannelEncodingType channelType, StreamingProtocol channelProtocol,
                                       string inputAddressAuthorized, int?inputSubnetPrefixLength,
                                       string previewAddressAuthorized, int?previewSubnetPrefixLength)
        {
            IPRange inputAddressRange = new IPRange();

            if (string.IsNullOrEmpty(inputAddressAuthorized))
            {
                inputAddressRange.Name               = Constant.Media.Live.AllowAnyAddress;
                inputAddressRange.Address            = new IPAddress(0);
                inputAddressRange.SubnetPrefixLength = 0;
            }
            else
            {
                inputAddressRange.Name               = Constant.Media.Live.AllowAuthorizedAddress;
                inputAddressRange.Address            = IPAddress.Parse(inputAddressAuthorized);
                inputAddressRange.SubnetPrefixLength = inputSubnetPrefixLength.Value;
            }

            IPRange previewAddressRange = new IPRange();

            if (string.IsNullOrEmpty(previewAddressAuthorized))
            {
                previewAddressRange.Name               = Constant.Media.Live.AllowAnyAddress;
                previewAddressRange.Address            = new IPAddress(0);
                previewAddressRange.SubnetPrefixLength = 0;
            }
            else
            {
                previewAddressRange.Name               = Constant.Media.Live.AllowAuthorizedAddress;
                previewAddressRange.Address            = IPAddress.Parse(previewAddressAuthorized);
                previewAddressRange.SubnetPrefixLength = previewSubnetPrefixLength.Value;
            }

            ChannelCreationOptions channelOptions = new ChannelCreationOptions()
            {
                Name         = channelName,
                EncodingType = channelType,
                Input        = new ChannelInput()
                {
                    StreamingProtocol = channelProtocol,
                    AccessControl     = new ChannelAccessControl()
                    {
                        IPAllowList = new IPRange[] { inputAddressRange }
                    }
                },
                Preview = new ChannelPreview()
                {
                    AccessControl = new ChannelAccessControl()
                    {
                        IPAllowList = new IPRange[] { previewAddressRange }
                    }
                }
            };

            if (channelType != ChannelEncodingType.None)
            {
                channelOptions.Encoding = new ChannelEncoding()
                {
                    SystemPreset = Constant.Media.Live.ChannelEncodingPreset
                };
            }

            return(_media.Channels.Create(channelOptions));
        }
 static ChannelEncoding MakeChannelEncoding(ChannelEncodingType encodingType)
 {
     return new ChannelEncoding
     {
         SystemPreset = encodingType == ChannelEncodingType.Standard ? "Default720p" : "Default1080p",
         IgnoreCea708ClosedCaptions = false,
         AdMarkerSource = AdMarkerSource.Api,
         AudioStreams = new List<AudioStream> {new AudioStream {Index = 103, Language = "eng"}}.AsReadOnly()
     };
 }