RequestChannel() public method

public RequestChannel ( System.Guid channel_id, Uri tracker_uri ) : Channel
channel_id System.Guid
tracker_uri System.Uri
return Channel
Beispiel #1
0
        private async Task <Channel> RequestChannel(
            StreamName stream_name,
            CancellationToken cancel_token)
        {
            Guid channel_id;

            if (!Guid.TryParse(stream_name.Name, out channel_id))
            {
                return(null);
            }
            var tracker_uri =
                stream_name.Parameters.ContainsKey("tip") ?
                OutputStreamBase.CreateTrackerUri(channel_id, stream_name.Parameters["tip"]) :
                null;
            var channel = owner.RequestChannel(channel_id, tracker_uri);

            if (channel == null)
            {
                return(null);
            }
            await Task.WhenAny(
                Task.Delay(10000),
                channel.WaitForReadyContentTypeAsync(cancel_token)).ConfigureAwait(false);

            if (channel.ChannelInfo == null ||
                String.IsNullOrEmpty(channel.ChannelInfo.ContentType) ||
                channel.ChannelInfo.ContentType != "FLV")
            {
                return(null);
            }
            return(channel);
        }