mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Removing dependency on Part for rendering videos
This commit is contained in:
@@ -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,
|
||||
|
@@ -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.
|
||||
|
@@ -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("-", "");
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user