예제 #1
0
        /// <summary>
        /// Gets the expiry date of the stream URL.
        /// Returns null if the expiry date could not be parsed.
        /// </summary>
        public static DateTimeOffset?GetUrlExpiryDate(this MediaStreamInfo streamInfo)
        {
            streamInfo.GuardNotNull(nameof(streamInfo));

            var expiryDateUnix = Regex.Match(streamInfo.Url, @"expire[=/](\d+)").Groups[1].Value.ParseLongOrDefault();

            if (expiryDateUnix == 0L)
            {
                return(null);
            }

            return(new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero).AddSeconds(expiryDateUnix));
        }
예제 #2
0
 /// <summary />
 public MediaStream(MediaStreamInfo info, Stream stream)
 {
     Info    = info.GuardNotNull(nameof(info));
     _stream = stream.GuardNotNull(nameof(stream));
 }