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); }
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 static async void ShowToast <T>(this T notificationServiceOwner, Client.Common.Models.PlaylistItem model) where T : IToastNotificationCapable { await notificationServiceOwner.ToastNotificationService.Show(new ToastNotificationOptions { ImageUrl = model.CoverArtUrl, Title = model.Title, Subtitle = model.Artist }); }
async void IPlayer.Play(PlaylistItem item, object options) { await AssureVideoPlaybackIsInitalized(); OnStartingPlayback(); var startInfo = GetStartInfo(item, options as PlaybackStateEventArgs); Source = startInfo.Source; _pendingPlayerActions = new List <Action> { () => _playerControls.SetStartTime(startInfo.StartTime.Negate()), () => _playerControls.SetEndTime(startInfo.EndTime), () => _playerControls.Play() }; ExecutePlayerDependentActions(); }
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; }
async void IPlayer.Play(PlaylistItem item, object options) { await AssureVideoPlaybackIsInitalized(); OnStartingPlayback(); var startInfo = GetStartInfo(item, options as PlaybackStateEventArgs); Source = startInfo.Source; _pendingPlayerActions = new List<Action> { () => _playerControls.SetStartTime(startInfo.StartTime.Negate()), () => _playerControls.SetEndTime(startInfo.EndTime), () => _playerControls.Play() }; ExecutePlayerDependentActions(); }
public void Play(PlaylistItem item, object options = null) { }