public void GetUriForVideoStartingAt_Always_ReturnsTheOriginalUriModifiedToHaveTheGivenTimeOffsetParameter() { var input = new Uri("http://google.com/stream/stream.ts?id=30437&hls=true&timeOffset=0&duration=10&maxBitRate=50"); var uriForVideoStartingAt = _subject.GetUriForVideoStartingAt(input, 100); var expectedUri = new Uri("http://google.com/stream/stream.ts?id=30437&hls=true&timeOffset=100&duration=10&maxBitRate=50"); uriForVideoStartingAt.Should().Be(expectedUri); }
private VideoStartInfo GetStartInfo(PlaylistItem item, PlaybackStateEventArgs eventArgs) { var videoStartInfo = new VideoStartInfo(); if (eventArgs == null) { videoStartInfo.StartTime = TimeSpan.Zero; videoStartInfo.EndTime = TimeSpan.FromSeconds(item.Duration); } else { if (eventArgs.TimeRemaining != TimeSpan.Zero) { videoStartInfo.StartTime = eventArgs.EndTime - eventArgs.TimeRemaining - eventArgs.StartTime; videoStartInfo.EndTime = eventArgs.TimeRemaining; } else { videoStartInfo.StartTime = eventArgs.StartTime; videoStartInfo.EndTime = eventArgs.EndTime; } } videoStartInfo.EndTime = videoStartInfo.EndTime == TimeSpan.Zero ? TimeSpan.FromSeconds(item.Duration) : videoStartInfo.EndTime; videoStartInfo.Source = SubsonicService.GetUriForVideoStartingAt( item.Uri, videoStartInfo.StartTime.TotalSeconds); return(videoStartInfo); }
public virtual void Handle(StartVideoPlaybackMessage message) { Item = message.Item; StartTime = TimeSpan.FromSeconds(message.StartTime).Negate(); EndTime = TimeSpan.FromSeconds(message.EndTime); Source = SubsonicService.GetUriForVideoStartingAt(message.Item.Uri, message.StartTime); }