Exemple #1
0
        public bool ChangeStream(StreamDescription stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream), "stream cannot be null");
            }

            if (availableStreams.Count <= stream.Id)
            {
                throw new ArgumentOutOfRangeException();
            }

            var newMedia          = availableStreams[stream.Id].Media;
            var newRepresentation = availableStreams[stream.Id].Representation;

            var newStream = new DashStream(newMedia, newRepresentation);

            if (currentStream.Media.Type.Value != newMedia.Type.Value)
            {
                throw new ArgumentException("wrong media type");
            }

            if (newStream.Equals(currentStream))
            {
                Logger.Info($"Selected stream {stream.Id} {stream.Description} already playing. Not changing.");
                return(false);
            }

            SetStream(newStream);
            Logger.Info($"Stream {stream.Id} {stream.Description} set.");
            return(true);
        }
Exemple #2
0
 public List <StreamDescription> GetStreamsDescription()
 {
     return(availableStreams.Select((o, i) =>
                                    new StreamDescription
     {
         Id = i,
         Description = CreateStreamDescription(o),
         StreamType = StreamType,
         Default = currentStream.Equals(o)
     }).ToList());
 }