Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Add IOSRenditions and DigitalMaster support to the BrightcoveVideo object #38

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,32 @@ public ICollection<BrightcoveRendition> Renditions
set;
}

/// <summary>
/// A short description describing the Video, limited to 250 characters. The
/// shortDescription is a required property when you create a video.
/// <summary>
/// An collection of IOS Renditions that represents one of the multi-bitrate streaming renditions
/// available for this Video.
/// Note that this property is WRITABLE for remote assets only. It supports READ access.
/// </summary>
public string ShortDescription
public ICollection<BrightcoveRendition> IOSRenditions
{
get;
set;
}

/// <summary>
/// The DigitalMaster object represents a special rendition that will not have urls.
/// This is the source file that was uploaded and is read-only.
/// </summary>
public BrightcoveRendition DigitalMaster
{
get;
set;
}

/// <summary>
/// A short description describing the Video, limited to 250 characters. The
/// shortDescription is a required property when you create a video.
/// </summary>
public string ShortDescription
{
get;
set;
Expand Down Expand Up @@ -277,6 +298,7 @@ public BrightcoveVideo()
Tags = new List<string>();
CustomFields = new CustomFieldCollection();
Renditions = new List<BrightcoveRendition>();
IOSRenditions = new List<BrightcoveRendition>();
CuePoints = new List<BrightcoveCuePoint>();
ItemState = ItemState.Active;
Economics = Economics.Free;
Expand Down Expand Up @@ -331,8 +353,12 @@ public IDictionary<string, object> Serialize(JavaScriptSerializer serializer)
{
serialized["videoFullLength"] = VideoFullLength;
}
if (IOSRenditions.Count > 0)
{
serialized["IOSRenditions"] = IOSRenditions.Where(r => !String.IsNullOrEmpty(r.RemoteUrl));
}

if (CuePoints.Count > 0)
if (CuePoints.Count > 0)
{
serialized["cuePoints"] = CuePoints;
}
Expand Down Expand Up @@ -444,11 +470,19 @@ public void Deserialize(IDictionary<string, object> dictionary, JavaScriptSerial
ReferenceId = (string)dictionary[key];
break;

case "renditions":
Renditions = serializer.ConvertToType<BrightcoveItemCollection<BrightcoveRendition>>(dictionary[key]);
break;
case "renditions":
Renditions = serializer.ConvertToType<BrightcoveItemCollection<BrightcoveRendition>>(dictionary[key]);
break;

case "IOSRenditions":
IOSRenditions = serializer.ConvertToType<BrightcoveItemCollection<BrightcoveRendition>>(dictionary[key]);
break;

case "digitalMaster":
DigitalMaster = serializer.ConvertToType<BrightcoveRendition>(dictionary[key]);
break;

case "shortDescription":
case "shortDescription":
ShortDescription = (string)dictionary[key];
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
<ItemGroup>
<None Include="Assets\Sample_CaptionFile.dfxp" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,53 @@

namespace BrightcoveOS.NET_MAPI_Wrapper.Tests.IntegrationTests.VideoRead
{
[TestFixture]
public class FindVideoByReferenceIdTests : VideoReadTestBase
{
private string _refId = "1939643268001";

[Test]
public void FindVideoByRefId_Basic()
{
BrightcoveVideo video = _api.FindVideoByReferenceId(_refId);

Assert.IsNotNull(video);
Assert.AreEqual(1939643268001, video.Id);
Assert.AreEqual("Wildlife_TamarinMonkey", video.Name);
Assert.AreEqual("Wildlife_TamarinMonkey", video.ShortDescription);
}

[Test]
public void FindVideoByRefId_Renditions()
{
BrightcoveVideo video = _api.FindVideoByReferenceId(_refId);

Assert.Greater(video.Renditions.Count, 0);
}

[Test]
public void FindVideoByRefId_NonExistent()
{
string refId = "doesn't exist!";
BrightcoveVideo video = _api.FindVideoByReferenceId(refId);

Assert.IsNull(video);
}
}
[TestFixture]
public class FindVideoByReferenceIdTests : VideoReadTestBase
{
private string _refId = "1939643268001";

[Test]
public void FindVideoByRefId_Basic()
{
BrightcoveVideo video = _api.FindVideoByReferenceId(_refId);

Assert.IsNotNull(video);
Assert.AreEqual(1939643268001, video.Id);
Assert.AreEqual("Wildlife_TamarinMonkey", video.Name);
Assert.AreEqual("Wildlife_TamarinMonkey", video.ShortDescription);
}

[Test]
public void FindVideoByRefId_Renditions()
{
BrightcoveVideo video = _api.FindVideoByReferenceId(_refId);

Assert.Greater(video.Renditions.Count, 0);
}

[Test]
public void FindVideoByRefId_IOSRenditions()
{
BrightcoveVideo video = _api.FindVideoByReferenceId(_refId, new[] { "IOSRenditions" });

Assert.Greater(video.IOSRenditions.Count, 0);
}

[Test]
public void FindVideoByRefId_DigitalMaster()
{
BrightcoveVideo video = _api.FindVideoByReferenceId(_refId, new[] { "digitalMaster" });

Assert.IsNotNull(video.DigitalMaster);
}

[Test]
public void FindVideoByRefId_NonExistent()
{
string refId = "doesn't exist!";
BrightcoveVideo video = _api.FindVideoByReferenceId(refId);

Assert.IsNull(video);
}
}
}