PeerCastStation.FLV.RTMP.RTMPOutputStream.RequestChannel C# (CSharp) Method

RequestChannel() public method

public RequestChannel ( System.Guid channel_id, Uri tracker_uri ) : Channel
channel_id System.Guid
tracker_uri System.Uri
return Channel
		public Channel RequestChannel(Guid channel_id, Uri tracker_uri)
		{
			var channel = peerCast.RequestChannel(channel_id, tracker_uri, true);
			this.channel = channel;
			if (channel!=null) {
				channel.AddOutputStream(this);
			}
			return channel;
		}

Usage Example

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);
        }