Exemplo n.º 1
0
        public TimelineData(TimelineLayout layout, TimelinePlayback playback)
        {
            _layout = layout;


            _playback = playback;
            Captions  = new ObservableCollection <Caption>();
        }
Exemplo n.º 2
0
        public static TimelineData FakeData(TimelineLayout layout, TimelinePlayback playback)
        {
            var timeline = new TimelineData(layout, playback);

            for (var i = 0; i < 30; i++)
            {
                timeline.AddCaption(Caption.FakeData(layout, timeline));
            }

            return(timeline);
        }
Exemplo n.º 3
0
        public RootControl()
        {
            TimelineLayout = new TimelineLayout();
            Playback       = new TimelinePlayback(TimeSpan.FromMinutes(3));
            Timeline       = TimelineData.FakeData(TimelineLayout, Playback);

            InitializeComponent();

            this.video.Position = TimeSpan.Zero;


            Playback.WhenTimeChanged.Subscribe(time =>
            {
                var scrollPosition = TimelineLayout.GetScrollPosition(time);

                //var playerHeadPosition = TimelineLayout.GetPlayerHeadPosition(time);

                //overlay.Set(playerHeadPosition);

                ScrollTo(scrollPosition);

                whenTimeChanged.OnNext(time);

                var caption = Timeline.PlaybackCaption;

                whenPlaybackCaptionChanged.OnNext(caption);

                Thread.Sleep(100);
            });

            var viewer = new WaveViewer();

            viewer.BackColor  = System.Drawing.Color.LightGray;
            viewer.WaveStream = new WaveFileReader(@"C:\Users\Amichai\Desktop\The Zahir.wav");

            this.Host.Child = viewer;

            TimelineLayout.WhenZoomChanged.Subscribe(zoom =>
            {
                var scale = TimelineLayout.Zoom / 100f;
                viewer.SamplesPerPixel = (int)Math.Round(128 / scale);
            });
        }