예제 #1
0
        public async void SimpleDecoding()
        {
            var decoder     = GetDecoder();
            var videoLength = await decoder.GetLengthAsync();

            //This video should be about 5 seconds long
            Assert.InRange(videoLength, TimeFormatter.TimeFromSeconds(4), TimeFormatter.TimeFromSeconds(6));
        }
예제 #2
0
        public void SetSettings()
        {
            TimelineOverviewSwitch.IsToggled = PlaybarView.DataTrackline.IsVisible;
            PlaybackSpeedButton.Text         = PlaybarView.PlaybackSpeed.ToString() + "x";

            WindowSlider.Maximum = TimeFormatter.SecondsFromTime(Math.Max(
                                                                     PlaybarView.ViewerContext.AvailableTimeTo - PlaybarView.ViewerContext.AvailableTimeFrom,
                                                                     TimeFormatter.TimeFromSeconds(WindowSlider.Maximum)));
            WindowSlider.Value = TimeFormatter.SecondsFromTime(PlaybarView.WindowSize);
        }
        public static async Task <VideoView> Create(IDataPoint datapoint, TimeSynchronizedContext context)
        {
            // TODO: Check that this datapoint has a type that can be used
            var viewer = await context.GetDataViewerFor(datapoint);

            var view = new VideoView(context, datapoint);

            view.AddViewer(viewer);

            if (!(viewer is ArchiveVideoVideoViewer videoViewer))
            {
                return(view);
            }

            var(streamFactory, mime) = videoViewer.Video.GetStreamFactory();
            view.SetStreamFactory(streamFactory, mime);

            if (viewer.DataPoint.Time is ArchiveVideoTime time)
            {
                view.StartTime              = time.Offset;
                time.OffsetChanged         += (s, offset) => view.StartTime = offset;
                view._player.OffsetChanged += (s, offset) => time.VideoPlaybackOffset = TimeFormatter.TimeFromSeconds(offset);
            }

            context.SelectedTimeRangeChanged += view.OnSelectedTimeRangeChanged;
            context.IsPlayingChanged         += view.IsPlayingChanged;
            context.PlaybackRateChanged      += view.PlaybackRateChanged;
            view.IsPlayingChanged(null, context.IsPlaying);
            view.PlaybackRateChanged(null, context.PlaybackRate);

            return(view);
        }