Example #1
0
        public ArchiveVideo(JObject json, Archive.Archive archive, Guid sessionId) : base(json)
        {
            var pathArr = Meta["attachments"].ToObject <string[]>() ?? throw new ArgumentException("Video is missing 'attachments'");
            var path    = "" + sessionId + pathArr[0];

            _archive = archive;

            var offset = Meta["start_time"].Value <long>();

            // Find the file in the archive
            _zipEntry = _archive.FindFile(path) ?? throw new ZipException($"Video file '{path}' not found in archive");

            var estimatedVideoLength = 0L;

            if (Meta.TryGetValue("video_length", out var value))
            {
                estimatedVideoLength = value.Value <long>();
            }

            // Create the video datapoint
            _video = new ArchiveVideoVideo(_zipEntry, _archive, path, offset, estimatedVideoLength)
            {
                Name = "Video"
            };

            AddDataPoint(_video);
            IsSaved = true;
        }
Example #2
0
        public ArchiveVideo(JObject json, IReadSeekStreamFactory readerFactory) : base(json)
        {
            Meta["type"] = Type;

            _readerFactory = readerFactory;
            var estimatedVideoLength = 0L;

            if (Meta.TryGetValue("video_length", out var value))
            {
                estimatedVideoLength = value.Value <long>();
            }

            _video = new ArchiveVideoVideo(readerFactory, readerFactory.Name, Meta["start_time"].Value <long>(), estimatedVideoLength)
            {
                Name = "Video"
            };
            Name = readerFactory.Name;

            AddDataPoint(_video);
            IsSaved = false;
        }