private void Player_PlaylistItemChanged(object player, CustomEventArgs <PlaylistItem> args)
 {
     if (PlaylistItemChanged != null)
     {
         var pli = new ScriptPlaylistItem(args.Value);
         PlaylistItemChanged(this, new ScriptEventArgs <ScriptPlaylistItem>(pli));
     }
 }
 private void Player_PlaylistItemChanged(object player, CustomEventArgs<PlaylistItem> args)
 {
     if (PlaylistItemChanged != null)
     {
         var pli = new ScriptPlaylistItem(args.Value);
         PlaylistItemChanged(this, new ScriptEventArgs<ScriptPlaylistItem>(pli));
     }
 }
Example #3
0
 public void AddPlaylistItem(ScriptPlaylistItem playlistItem)
 {
     _items.Add(playlistItem);
 }
Example #4
0
        /// <summary>
        /// Converts this scriptable Playlist into playlist that can be consumed by the SMFPlayer.
        /// </summary>
        /// <returns>A collection of playlist items.</returns>
        public ObservableCollection <PlaylistItem> ToPlaylist()
        {
            var p = new ObservableCollection <PlaylistItem>();

            for (int i = 0; i < GetPlaylistItemCount(); i++)
            {
                ScriptPlaylistItem sItem = GetPlaylistItem(i);

                var thumbSource = !sItem.ThumbSource.IsNullOrWhiteSpace()
                                        ? new Uri(sItem.ThumbSource)
                                        : null;

                var item = new PlaylistItem
                {
                    DeliveryMethod =
                        (DeliveryMethods)
                        Enum.Parse(typeof(DeliveryMethods), sItem.DeliveryMethod, true),
                    Description      = sItem.Description,
                    FileSize         = sItem.FileSize,
                    FrameRate        = sItem.FrameRate,
                    JumpToLive       = sItem.JumpToLive,
                    MediaSource      = new Uri(sItem.MediaSource),
                    ThumbSource      = thumbSource,
                    Title            = sItem.Title,
                    VideoHeight      = sItem.VideoHeight,
                    VideoStretchMode =
                        (Stretch)Enum.Parse(typeof(Stretch), sItem.VideoStretchMode, true),
                    VideoWidth     = sItem.VideoWidth,
                    CustomMetadata = sItem.CustomMetadata,
                    S3DProperties  = (sItem.ScriptS3DProperties == null) ? null : sItem.ScriptS3DProperties.ConvertToS3DProperties(),
                    BearerToken    = sItem.BearerToken /* we need this to provide AMS key auth support for license delivery */
                };

                for (int j = 0; j < sItem.MarkerCount; j++)
                {
                    ScriptMediaMarker smm = sItem.GetMarker(j);

                    if (!smm.Type.IsNullOrWhiteSpace() && smm.Type.Equals("timeline", StringComparison.OrdinalIgnoreCase))
                    {
                        item.TimelineMarkers.Add(new TimelineMediaMarker
                        {
                            AllowSeek = smm.AllowSeek,
                            Begin     = TimeSpan.FromSeconds(smm.Begin),
                            End       = TimeSpan.FromSeconds(smm.End),
                            Id        = smm.Id,
                            Content   = smm.Content
                        });
                    }
                }
                for (int j = 0; j < sItem.ChapterCount; j++)
                {
                    ScriptChapter sci = sItem.GetChapter(j);
                    item.Chapters.Add(new Chapter
                    {
                        Begin       = TimeSpan.FromSeconds(sci.Begin),
                        End         = TimeSpan.FromSeconds(sci.End),
                        Id          = sci.Id,
                        Content     = sci.Content,
                        Description = sci.Description,
                        Title       = sci.Title,
                        ThumbSource = new Uri(sci.ThumbSource),
                        Type        = "chapter"
                    });
                }
                p.Add(item);
            }
            return(p);
        }
Example #5
0
 public void AddPlaylistItem(ScriptPlaylistItem playlistItem)
 {
     _items.Add(playlistItem);
 }