Esempio n. 1
0
        private IMediaService GetMediaService(MediaResourceCreateCommand command)
        {
            if (command.Type == "file")
            {
                var mediaType = MediaTypeUtility.GetMediaTypeInfoForMimeType(command.FileMimeType).MediaType;

                if (mediaType == "image")
                {
                    return(_mediaServiceFactory.CreateImageService());
                }
                if (mediaType == "audio")
                {
                    return(_mediaServiceFactory.CreateAudioService());
                }
            }
            else if (command.Type == "externalvideo")
            {
                if (command.VideoProviderName.ToLower() == "youtube")
                {
                    return(_mediaServiceFactory.CreateYouTubeVideoService());
                }
                if (command.VideoProviderName.ToLower() == "vimeo")
                {
                    return(_mediaServiceFactory.CreateVimeoVideoService());
                }
            }

            throw new ArgumentException(string.Format("A media service could not be found for the specified type '{0}'.", command.Type));
        }