private ActionResult UpdateImplementation(CloudVideoPart part, string folderPath, LocalizedString notification, bool publish) { if (!_authorizer.Authorize(Permissions.ManageCloudMediaContent, T("You are not authorized to manage Microsoft Azure Media content."))) { return(new HttpUnauthorizedResult()); } Logger.Debug("User requested to save cloud video item with ID {0}.", part.Id); var editorShape = _contentManager.UpdateEditor(part, this); if (!ModelState.IsValid) { _transactionManager.Cancel(); var viewModel = New.ViewModel(FolderPath: folderPath, Editor: editorShape); return(View(viewModel)); } var mediaPart = part.As <MediaPart>(); mediaPart.LogicalType = "CloudVideo"; if (String.IsNullOrWhiteSpace(mediaPart.MimeType)) { var mezzanineAsset = _assetManager.LoadAssetsFor <MezzanineAsset>(part).Single(); mediaPart.MimeType = mezzanineAsset.MimeType; } if (!String.IsNullOrWhiteSpace(folderPath)) { mediaPart.FolderPath = folderPath; } try { if (publish) { _contentManager.Publish(mediaPart.ContentItem); } Logger.Information("Cloud video item with ID {0} was saved.", part.Id); _notifier.Information(notification); } catch (Exception ex) { _transactionManager.Cancel(); Logger.Error(ex, "Error while saving cloud video item with ID {0}.", part.Id); _notifier.Error(T("Ar error occurred while saving the cloud video item:\n{1}", ex.Message)); } return(RedirectToAction("Edit", new { id = part.Id })); }
private IShape CreatePlayershape(CloudVideoPart part, HtmlNode node) { var playerWidth = GetInt32(node, "data-player-width"); var playerHeight = GetInt32(node, "data-player-height"); var applyMediaQueries = GetBoolean(node, "data-player-apply-media-queries"); var autoPlay = GetBoolean(node, "data-player-auto-play"); var playerShape = _shapeFactory.Create("CloudVideoPlayer", Arguments.From(new { ContentPart = part, ContentItem = part.ContentItem, AlternateText = part.As <MediaPart>().AlternateText, AssetId = default(int?), IgnoreIncludeInPlayer = false, AllowPrivateUrls = false, PlayerWidth = playerWidth, PlayerHeight = playerHeight, ApplyMediaQueries = applyMediaQueries, AutoPlay = autoPlay })); return(playerShape); }