public static void SelectMovie(ListItem item) { var t = new Trailer { Title = (string)item.AdditionalProperties[NAME], Url = (string)item.AdditionalProperties[TRAILER] }; if (t.Url != "") { CinemaPlayerHelper.PlayStream(t); } }
/// <summary> /// Constructs a dynamic <see cref="MediaItem"/> that contains the URL for the given <paramref name="trailer"/>. /// </summary> /// <param name="trailer">Trailer.</param> private static MediaItem CreateStreamMediaItem(Trailer trailer) { IDictionary<Guid, MediaItemAspect> aspects = new Dictionary<Guid, MediaItemAspect>(); MediaItemAspect providerResourceAspect; aspects[ProviderResourceAspect.ASPECT_ID] = providerResourceAspect = new MediaItemAspect(ProviderResourceAspect.Metadata); MediaItemAspect mediaAspect; aspects[MediaAspect.ASPECT_ID] = mediaAspect = new MediaItemAspect(MediaAspect.Metadata); aspects[VideoAspect.ASPECT_ID] = new MediaItemAspect(VideoAspect.Metadata); // VideoAspect needs to be contained for player mapping providerResourceAspect.SetAttribute(ProviderResourceAspect.ATTR_RESOURCE_ACCESSOR_PATH, RawUrlResourceProvider.ToProviderResourcePath(trailer.Url).Serialize()); providerResourceAspect.SetAttribute(ProviderResourceAspect.ATTR_SYSTEM_ID, ServiceRegistration.Get<ISystemResolver>().LocalSystemId); mediaAspect.SetAttribute(MediaAspect.ATTR_MIME_TYPE, CINEMA_MIMETYPE); mediaAspect.SetAttribute(MediaAspect.ATTR_TITLE, trailer.Title); var mediaItem = new MediaItem(Guid.Empty, aspects); return mediaItem; }
public static void PlayStream(Trailer trailer) { var mediaItem = CreateStreamMediaItem(trailer); PlayItemsModel.PlayItem(mediaItem); }