public TimelineData(TimelineLayout layout, TimelinePlayback playback) { _layout = layout; _playback = playback; Captions = new ObservableCollection <Caption>(); }
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); }
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); }); }