Exemplo n.º 1
0
        public LiveEvent CreateLiveEvent(string eventName, string eventDescription, string eventTags, string inputStreamId,
                                         LiveEventInputProtocol inputProtocol, LiveEventEncodingType encodingType, string encodingPresetName,
                                         string streamingPolicyName, bool lowLatency, bool autoStart)
        {
            LiveEventInput eventInput = new LiveEventInput()
            {
                AccessToken       = inputStreamId,
                StreamingProtocol = inputProtocol,
                AccessControl     = new LiveEventInputAccessControl()
                {
                    Ip = new IPAccessControl()
                    {
                        Allow = new IPRange[]
                        {
                            new IPRange()
                            {
                                Name               = "Any IP Address",
                                Address            = "0.0.0.0",
                                SubnetPrefixLength = 0
                            }
                        }
                    }
                }
            };
            LiveEventEncoding eventEncoding = new LiveEventEncoding()
            {
                EncodingType = encodingType,
                PresetName   = encodingPresetName
            };
            LiveEventPreview eventPreview = new LiveEventPreview()
            {
                PreviewLocator      = inputStreamId,
                StreamingPolicyName = streamingPolicyName
            };
            List <StreamOptionsFlag?> streamOptions = new List <StreamOptionsFlag?>();

            if (lowLatency)
            {
                streamOptions.Add(StreamOptionsFlag.LowLatency);
            }
            else
            {
                streamOptions.Add(StreamOptionsFlag.Default);
            }
            MediaService mediaService = _media.Mediaservices.Get(MediaAccount.ResourceGroupName, MediaAccount.Name);
            LiveEvent    liveEvent    = new LiveEvent()
            {
                VanityUrl   = true,
                Description = eventDescription,
                //Tags = GetCorrelationData(eventTags, false),
                Input         = eventInput,
                Encoding      = eventEncoding,
                Preview       = eventPreview,
                StreamOptions = streamOptions,
                Location      = mediaService.Location
            };

            return(_media.LiveEvents.Create(MediaAccount.ResourceGroupName, MediaAccount.Name, eventName, liveEvent, autoStart));
        }
Exemplo n.º 2
0
        public LiveEvent CreateLiveEvent(string eventName, string eventDescription, string eventTags, LiveEventInputProtocol inputProtocol,
                                         LiveEventEncodingType encodingType, string encodingPresetName, string streamingPolicyName,
                                         bool lowLatency, bool autoStart)
        {
            LiveEventInput eventInput = new LiveEventInput()
            {
                StreamingProtocol = inputProtocol
            };
            LiveEventEncoding eventEncoding = new LiveEventEncoding()
            {
                EncodingType = encodingType,
                PresetName   = encodingPresetName
            };
            LiveEventPreview eventPreview = new LiveEventPreview()
            {
                StreamingPolicyName = streamingPolicyName
            };
            List <StreamOptionsFlag?> streamOptions = new List <StreamOptionsFlag?>();

            if (lowLatency)
            {
                streamOptions.Add(StreamOptionsFlag.LowLatency);
            }
            MediaService mediaService = _media.Mediaservices.Get(MediaAccount.ResourceGroupName, MediaAccount.Name);
            LiveEvent    liveEvent    = new LiveEvent()
            {
                VanityUrl     = true,
                Description   = eventDescription,
                Tags          = GetDataItems(eventTags),
                Input         = eventInput,
                Encoding      = eventEncoding,
                Preview       = eventPreview,
                StreamOptions = streamOptions,
                Location      = mediaService.Location
            };

            return(_media.LiveEvents.Create(MediaAccount.ResourceGroupName, MediaAccount.Name, eventName, liveEvent, autoStart));
        }
Exemplo n.º 3
0
 public LiveEventRestObject(string name, string location, string description, bool?vanityUrl, LiveEventEncoding encoding, LiveEventInput input, LiveEventPreview preview, IList <StreamOptionsFlag?> streamOptions, IList <TranscriptionForRest> transcriptions)
 {
     Name       = name;
     Location   = location;
     Properties = new PropertiesForRest {
         Description = description, VanityUrl = vanityUrl, Encoding = encoding, Input = input, Preview = preview, StreamOptions = streamOptions, Transcriptions = transcriptions
     };
 }