public void SetElement(object value, CommentMode mode) { var newPlayByPlay = value as PlayByPlay; if (newPlayByPlay != null) { this.CommentMode = mode; if (mode == CommentMode.Timeline) { this.sequenceRegistry.CurrentSequence.Markers.Remove(this.playByPlay); } this.playByPlay = newPlayByPlay; if (mode == CommentMode.Timeline) { if (!this.sequenceRegistry.CurrentSequence.Markers.Contains(this.playByPlay)) { this.sequenceRegistry.CurrentSequence.Markers.Add(this.playByPlay); } } this.SetPosition(TimeSpan.FromTicks(this.playByPlay.Time)); this.View.Close(); } }
private PlayByPlay CreatePlayByPlayFromEventData(EventData eventData) { var pbp = new PlayByPlay(TimeSpan.FromSeconds(this.startPosition.TotalSeconds).Ticks); pbp.EventId = eventData.Id; pbp.Text = eventData.Text; pbp.Time = TimeSpan.FromSeconds(eventData.Time.TotalSeconds - this.startPosition.TotalSeconds).Ticks; return(pbp); }
public void AddPreview(AddPreviewPayload payload) { PlayByPlay playByPlayMarker = payload.Value as PlayByPlay; if (playByPlayMarker == null) { return; } this.videoAssetInOut.AddPlayByPlayMarker(playByPlayMarker); }
private static void WritePlayByPlay(XmlWriter writer, CompositeManifestInfo manifestInfo) { if (manifestInfo.PlayByPlayEvents.Count > 0) { StreamInfo streamInfo = WriteCompositeManifestStandardStreamIndex(manifestInfo.PlayByPlayDataStreamName, manifestInfo.PlayByPlayEvents.Count); for (int i = 0; i < manifestInfo.PlayByPlayEvents.Count; i++) { PlayByPlay pbp = manifestInfo.PlayByPlayEvents[i]; StringBuilder output = new StringBuilder(); XmlWriter tempWriter = CreateWriter(output, true, true); if (tempWriter != null) { tempWriter.WriteStartElement("InStreamEnvelope"); tempWriter.WriteAttributeString("Id", pbp.ID.ToString()); tempWriter.WriteAttributeString("Action", "Add"); tempWriter.WriteAttributeString("TargetID", string.Empty); tempWriter.WriteAttributeString("Priority", "1"); tempWriter.WriteStartElement("PlayByPlay"); tempWriter.WriteAttributeString("ID", pbp.ID.ToString()); tempWriter.WriteAttributeString("Time", pbp.Time.ToString(CultureInfo.InvariantCulture)); tempWriter.WriteAttributeString("IsTimelineMarker", "True"); tempWriter.WriteAttributeString("IsNavigable", "True"); tempWriter.WriteAttributeString("EditorialType", string.Empty); tempWriter.WriteAttributeString("Type", string.Empty); tempWriter.WriteCData(pbp.Text); tempWriter.WriteEndElement(); tempWriter.Close(); byte[] envelopeBytes = Encoding.UTF8.GetBytes(output.ToString()); string encodedEnvelope = Convert.ToBase64String(envelopeBytes); ulong?duration = null; if (i == manifestInfo.PlayByPlayEvents.Count - 1) { duration = 10000000; } Chunk chunk = new Chunk(null, (ulong)pbp.Time, duration, encodedEnvelope); streamInfo.Chunks.Add(chunk); } } WriteStreamIndex(writer, streamInfo, true); } }
public PlayByPlayDisplayBoxPresentationModel(IPlayByPlayDisplayBox view, IPlayByPlayViewPreview preview, ISequenceRegistry sequenceRegistry, IEventAggregator eventAggregator) { this.View = view; this.preview = preview; this.sequenceRegistry = sequenceRegistry; this.eventAggregator = eventAggregator; this.CloseCommand = new DelegateCommand <object>(this.Close); this.playByPlay = new PlayByPlay(0); this.View.Model = this; this.preview.Model = this; }
private void RemovePreview(RemovePreviewPayload payload) { this.RemoveSpecificPlayByPlayMarkers(this.timelineBarElements.Select( tbe => { PlayByPlay pbp = tbe.GetElement <PlayByPlay>(); if (pbp == null) { return(null); } return(pbp); }).Where(pbp => pbp != null && pbp.EventId == payload.EventId)); }
/// <summary> /// Adds a list of events to the current items collection. /// </summary> /// <param name="eventData">The eventData being added.</param> private void AddEvent(EventData eventData) { double?offset = this.configurationService.GetParameterValueAsDouble("GSISOffsetSeconds"); EventData currentEventData = this.availableMetadata.Where(x => x.Id == eventData.Id).FirstOrDefault(); if (currentEventData == null) { eventData.Time = eventData.Time.Add(TimeSpan.FromSeconds(offset.GetValueOrDefault())).Add( this.currentEventOffset); this.availableMetadata.Add(eventData); } PlayByPlay marker = this.CreatePlayByPlayFromEventData(eventData); this.eventAggregator.GetEvent <AddPreviewEvent>().Publish(new AddPreviewPayload("PlayByPlay", marker, CommentMode.SubClip)); this.ShowEvent(eventData); }