Removing dependency on Part for rendering videos

This commit is contained in:
Sebastien Ros
2014-05-29 15:55:59 -07:00
parent 454495445d
commit ab431c6e89
7 changed files with 27 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ using HtmlAgilityPack;
using Orchard.Azure.MediaServices.Models;
using Orchard.ContentManagement;
using Orchard.DisplayManagement;
using Orchard.MediaLibrary.Models;
using Orchard.Services;
namespace Orchard.Azure.MediaServices.Services.Rendering {
@@ -73,7 +74,9 @@ namespace Orchard.Azure.MediaServices.Services.Rendering {
var autoPlay = GetBoolean(node, "data-player-auto-play");
var playerShape = _shapeFactory.Create("CloudVideoPlayer", Arguments.From(new {
CloudVideoPart = part,
ContentPart = part,
ContentItem = part.ContentItem,
AlternateText = part.As<MediaPart>().AlternateText,
AssetId = default(int?),
IgnoreIncludeInPlayer = false,
AllowPrivateUrls = false,

View File

@@ -9,7 +9,7 @@ namespace Orchard.Azure.MediaServices.Shapes {
public void Discover(ShapeTableBuilder builder) {
builder.Describe("CloudVideoPlayer").OnDisplaying(context => {
var shape = context.Shape;
CloudVideoPart cloudVideoPart = shape.CloudVideoPart; // The cloud video item to render a player for.
CloudVideoPart cloudVideoPart = shape.ContentPart; // The cloud video item to render a player for.
int? assetId = shape.AssetId; // Set to limit the player to only one particular asset.
bool ignoreIncludeInPlayer = shape.IgnoreIncludeInPlayer; // True to ignore the IncludeInPlayer property of assets.
bool allowPrivateUrls = shape.AllowPrivateUrls; // True to allow private locator URLs to be used, otherwise false.

View File

@@ -21,8 +21,7 @@
Script.Include("cloudmedia-videoplayer-injectors-alt.js").AtFoot();
Script.Include("cloudmedia-videoplayer-main.js").AtFoot();
CloudVideoPart cloudVideoPart = Model.CloudVideoPart;
var altText = cloudVideoPart.As<MediaPart>().AlternateText;
var altText = Model.AlternateText;
var assetData = Model.AssetData;
var assetDataJson = JsonConvert.SerializeObject(assetData, Formatting.None);
var renderId = Guid.NewGuid().ToString().Replace("-", "");

View File

@@ -1,8 +1,12 @@
@model Orchard.Azure.MediaServices.Models.Assets.VideoAsset
@using Orchard.ContentManagement;
<fieldset>
<div class="preview">
@Display.CloudVideoPlayer(
CloudVideoPart: Model.VideoPart,
ContentPart: Model.VideoPart,
ContentItem: Model.VideoPart.ContentItem,
AlternateText: Model.VideoPart.As<Orchard.MediaLibrary.Models.MediaPart>().AlternateText,
AssetId: Model.Record.Id,
IgnoreIncludeInPlayer: true,
AllowPrivateUrls: true,

View File

@@ -1,6 +1,7 @@
@using Orchard.Azure.MediaServices.Helpers
@using Orchard.Azure.MediaServices.Models.Assets
@using Orchard.Azure.MediaServices.ViewModels.Media
@using Orchard.ContentManagement
@model CloudVideoPartViewModel
@{
var isCreatingItem = Model.Id == 0;
@@ -43,7 +44,9 @@
</div>
<div id="cloudvideo-preview">
@Display.CloudVideoPlayer(
CloudVideoPart: Model.Part,
ContentPart: Model.Part,
ContentItem: Model.Part.ContentItem,
AlternateText: Model.Part.As<Orchard.MediaLibrary.Models.MediaPart>().AlternateText,
AssetId: null,
IgnoreIncludeInPlayer: false,
AllowPrivateUrls: true,

View File

@@ -1,6 +1,10 @@
@* TODO: Perhaps only a thumbnail image and some metadata should be rendered in summary view? *@
@using Orchard.ContentManagement;
@* TODO: Perhaps only a thumbnail image and some metadata should be rendered in summary view? *@
@Display.CloudVideoPlayer(
CloudVideoPart: Model.ContentPart,
ContentPart: Model.ContentPart,
ContentItem: Model.ContentPart.ContentItem,
AlternateText: Model.ContentPart.As<Orchard.MediaLibrary.Models.MediaPart>().AlternateText,
AssetId: null,
IgnoreIncludeInPlayer: false,
AllowPrivateUrls: false,

View File

@@ -1,5 +1,9 @@
@Display.CloudVideoPlayer(
CloudVideoPart: Model.ContentPart,
@using Orchard.ContentManagement;
@Display.CloudVideoPlayer(
ContentPart: Model.ContentPart,
ContentItem: Model.ContentPart.ContentItem,
AlternateText: Model.ContentPart.As<Orchard.MediaLibrary.Models.MediaPart>().AlternateText,
AssetId: null,
IgnoreIncludeInPlayer: false,
AllowPrivateUrls: false,