Exemple #1
0
        public IPlayer GetPlayer(MediaItem mediaItem)
        {
            string mimeType;
            string title;

            if (!mediaItem.GetPlayData(out mimeType, out title))
            {
                return(null);
            }
            IResourceLocator locator = mediaItem.GetResourceLocator();

            if (!ImagePlayer.CanPlay(locator, mimeType))
            {
                return(null);
            }
            ImagePlayer player = new ImagePlayer();

            try
            {
                if (!player.NextItem(mediaItem, StartTime.AtOnce))
                {
                    player.Dispose();
                    return(null);
                }
            }
            catch (Exception e)
            {
                ServiceRegistration.Get <ILogger>().Warn("ImagePlayerBuilder: Error playing media item '{0}'", e, locator);
                player.Dispose();
                return(null);
            }
            return(player);
        }
 public IPlayer GetPlayer(MediaItem mediaItem)
 {
   string mimeType;
   string title;
   if (!mediaItem.GetPlayData(out mimeType, out title))
     return null;
   IResourceLocator locator = mediaItem.GetResourceLocator();
   if (!ImagePlayer.CanPlay(locator, mimeType))
     return null;
   ImagePlayer player = new ImagePlayer();
   try
   {
     if (!player.NextItem(mediaItem, StartTime.AtOnce))
     {
       player.Dispose();
       return null;
     }
   }
   catch (Exception e)
   {
     ServiceRegistration.Get<ILogger>().Warn("ImagePlayerBuilder: Error playing media item '{0}'", e, locator);
     player.Dispose();
     return null;
   }
   return player;
 }