Exemple #1
0
        /// <summary>
        /// Updates the specified video.
        /// </summary>
        /// <param name="video"></param>
        /// <returns></returns>
        public BrightcoveVideo UpdateVideo(BrightcoveVideo video)
        {
            BrightcoveParamCollection parms = CreateWriteParamCollection("update_video",
                                                                         methodParams => methodParams.Add("video", video));

            return(RunPost <BrightcoveResultContainer <BrightcoveVideo> >(parms).Result);
        }
Exemple #2
0
        public void FindVideoByRefIdUnfiltered_NonExistent()
        {
            string          refId = "doesn't exist!";
            BrightcoveVideo video = _api.FindVideoByReferenceIdUnfiltered(refId);

            Assert.IsNull(video);
        }
Exemple #3
0
 /// <summary>
 /// Creates a new video by uploading a file.
 /// </summary>
 /// <param name="video">The metadata for the video you want to create.</param>
 /// <param name="fileToUpload">The full path to the file to be uploaded.</param>
 /// <param name="encodeTo">If the file requires transcoding, use this parameter to specify the target encoding.
 /// Valid values are MP4 or FLV, representing the H264 and VP6 codecs respectively. Note that transcoding of
 /// FLV files to another codec is not currently supported. This parameter is optional and defaults to FLV.</param>
 /// <param name="createMultipleRenditions">If the file is a supported transcodeable type, this optional flag can be
 /// used to control the number of transcoded renditions. If true (default), multiple renditions at varying encoding
 /// rates and dimensions are created. Setting this to false will cause a single transcoded VP6 rendition to be created
 /// at the standard encoding rate and dimensions.</param>
 /// <param name="preserveSourceRendition">If the video file is H.264 encoded and if createMultipleRenditions is true,
 /// then multiple VP6 renditions are created and in addition the H.264 source is retained as an additional rendition.</param>
 /// <param name="h264NoProcessing">Use this option to prevent H.264 source files from being transcoded. This parameter cannot
 /// be used in combination with create_multiple_renditions. It is optional and defaults to false.</param>
 /// <returns>The numeric ID of the newly created video.</returns>
 public long CreateVideo(BrightcoveVideo video, string fileToUpload, EncodeTo encodeTo, bool createMultipleRenditions, bool preserveSourceRendition, bool h264NoProcessing)
 {
     using (FileStream fs = File.OpenRead(fileToUpload))
     {
         string fileName = new FileInfo(fileToUpload).Name;
         return(CreateVideo(video, new FileUploadInfo(fs, fileName), encodeTo, createMultipleRenditions, preserveSourceRendition,
                            h264NoProcessing));
     }
 }
Exemple #4
0
        public void FindVideoByRefIdUnfiltered_Basic()
        {
            BrightcoveVideo video = _api.FindVideoByReferenceIdUnfiltered(_refId);

            Assert.IsNotNull(video);
            Assert.AreEqual(1939643268001, video.Id);
            Assert.AreEqual("Wildlife_TamarinMonkey", video.Name);
            Assert.AreEqual("Wildlife_TamarinMonkey", video.ShortDescription);
        }
Exemple #5
0
        public void FindVideoByIdUnfiltered_Basic()
        {
            BrightcoveVideo video = _api.FindVideoByIdUnfiltered(_id);

            Assert.IsNotNull(video);
            Assert.AreEqual(_id, video.Id);
            Assert.AreEqual("Wildlife_TamarinMonkey", video.Name);
            Assert.AreEqual("Wildlife_TamarinMonkey", video.ShortDescription);
        }
        public void UpdateVideo_Test_Basic()
        {
            BrightcoveVideo video = _api.FindVideoById(_videoId);

            video.Name             = "Sea-SeaTurtle (updated)";
            video.ShortDescription = "Sea-SeaTurtle (updated description)";

            BrightcoveVideo returnedVideo = _api.UpdateVideo(video);

            Assert.AreEqual(video.Name, returnedVideo.Name);
            Assert.AreEqual(video.ShortDescription, returnedVideo.ShortDescription);
        }
        public void CreateVideo_Test_Basic()
        {
            BrightcoveVideo video = new BrightcoveVideo();

            video.Name             = "Test Video Creation";
            video.ReferenceId      = "test-reference-id";
            video.ShortDescription = "Test video, created via the API. Video is from the Creative Commons: http://creativecommons.org/videos/building-on-the-past";

            long newId = _api.CreateVideo(video, FileToUpload, EncodeTo.Mp4, false);

            Assert.That(newId, Is.GreaterThan(0));
        }
        public void CreateVideo_Test_Basic()
        {
            BrightcoveVideo video = new BrightcoveVideo();

            video.Name             = "Test Video Creation: Uploaded File";
            video.ReferenceId      = "test-reference-id";
            video.ShortDescription = "Test video, created via the API. Video is from the Creative Commons: http://creativecommons.org/videos/building-on-the-past";

            // Remove any previous videos using our test reference ID, or the CreateVideo call may fail due to a dupe ID
            DeleteExisting(video.ReferenceId);

            long newId = _api.CreateVideo(video, FileToUpload, EncodeTo.Mp4, false);

            Assert.That(newId, Is.GreaterThan(0));
        }
        public void UpdateVideo_Test_Dates()
        {
            BrightcoveVideo video     = _api.FindVideoById(_videoId);
            DateTime        yesterday = DateTime.Now.AddDays(-1);
            DateTime        tomorrow  = DateTime.Now.AddDays(1);

            video.StartDate = yesterday;
            video.EndDate   = tomorrow;

            BrightcoveVideo returnedVideo = _api.UpdateVideo(video);             // won't show the newly updated dates, so we have to make a separate call
            BrightcoveVideo foundVideo    = _api.FindVideoById(video.Id, new[] { "endDate", "startDate" });

            Assert.AreEqual(yesterday.ToString(), foundVideo.StartDate.ToString());
            Assert.AreEqual(tomorrow.ToString(), foundVideo.EndDate.ToString());
        }
Exemple #10
0
        public void FindAllVideos_Test_Fields()
        {
            _videos = _api.FindAllVideos(1, 0, SortBy.CreationDate, SortOrder.Descending, new List <string> {
                "id", "name", "shortDescription"
            });
            Assert.AreEqual(1, _videos.Count);
            BrightcoveVideo video = _videos.FirstOrDefault();

            // the 3 fields we specified should be present
            Assert.Greater(video.Id, 0);
            Assert.IsNotNullOrEmpty(video.Name);
            Assert.IsNotNullOrEmpty(video.ShortDescription);

            // other fields should not
            Assert.IsNullOrEmpty(video.LongDescription);
            Assert.IsNullOrEmpty(video.FlvUrl);
        }
Exemple #11
0
        /// <summary>
        /// Creates a new video by uploading a file.
        /// </summary>
        /// <param name="video">The metadata for the video you want to create.</param>
        /// <param name="fileUploadInfo">Information for the file to be uploaded.</param>
        /// <param name="encodeTo">If the file requires transcoding, use this parameter to specify the target encoding.
        /// Valid values are MP4 or FLV, representing the H264 and VP6 codecs respectively. Note that transcoding of
        /// FLV files to another codec is not currently supported. This parameter is optional and defaults to FLV.</param>
        /// <param name="createMultipleRenditions">If the file is a supported transcodeable type, this optional flag can be
        /// used to control the number of transcoded renditions. If true (default), multiple renditions at varying encoding
        /// rates and dimensions are created. Setting this to false will cause a single transcoded VP6 rendition to be created
        /// at the standard encoding rate and dimensions.</param>
        /// <param name="preserveSourceRendition">If the video file is H.264 encoded and if createMultipleRenditions is true,
        /// then multiple VP6 renditions are created and in addition the H.264 source is retained as an additional rendition.</param>
        /// <param name="h264NoProcessing">Use this option to prevent H.264 source files from being transcoded. This parameter cannot
        /// be used in combination with create_multiple_renditions. It is optional and defaults to false.</param>
        /// <returns>The numeric ID of the newly created video.</returns>
        public long CreateVideo(BrightcoveVideo video, FileUploadInfo fileUploadInfo, EncodeTo encodeTo, bool createMultipleRenditions, bool preserveSourceRendition, bool h264NoProcessing)
        {
            BrightcoveParamCollection parms = CreateWriteParamCollection("create_video",
                                                                         methodParams =>
            {
                methodParams.Add("video", video);
                if (encodeTo != EncodeTo.None)
                {
                    methodParams.Add("encode_to", encodeTo.ToString().ToUpper());
                }
                methodParams.Add("create_multiple_renditions", createMultipleRenditions.ToString().ToLower());
                methodParams.Add("preserve_source_rendition", preserveSourceRendition.ToString().ToLower());
                methodParams.Add("H264NoProcessing ", h264NoProcessing.ToString().ToLower());
            });

            return(RunFilePost <BrightcoveResultContainer <long> >(parms, fileUploadInfo).Result);
        }
        public void Sort_Videos_By_Creation_Date_No_Parameters()
        {
            // Perform the API call
            BrightcoveItemCollection <BrightcoveVideo> videos = Api.SearchVideos(new List <FieldValuePair>(),
                                                                                 new List <FieldValuePair>(),
                                                                                 new List <FieldValuePair>());

            BrightcoveVideo firstVideo         = videos.First();
            BrightcoveVideo expectedFirstVideo = AllVideos.OrderBy(x => x.CreationDate)
                                                 .First();
            BrightcoveVideo lastVideoOnPage          = videos.Last();
            BrightcoveVideo expectedLastVideoInRange = AllVideos.OrderBy(x => x.CreationDate)
                                                       .Skip(videos.PageSize - 1)
                                                       .First();

            Assert.AreEqual(expectedFirstVideo.Id, firstVideo.Id);
            Assert.AreEqual(expectedLastVideoInRange.Id, lastVideoOnPage.Id);
        }
        public void UpdateVideo_Test_CuePoints()
        {
            BrightcoveVideo    video    = _api.FindVideoById(_videoId);
            BrightcoveCuePoint cuePoint = new BrightcoveCuePoint
            {
                Name = "Test Cue Point",
                Time = 10000                 // 10 seconds in
            };

            video.CuePoints.Add(cuePoint);

            BrightcoveVideo returnedVideo = _api.UpdateVideo(video);             // won't show the newly updated cue points, so we have to make a separate call
            BrightcoveVideo foundVideo    = _api.FindVideoById(video.Id, new[] { "cuePoints" });

            Assert.Greater(foundVideo.CuePoints.Count, 0);
            Assert.AreEqual(cuePoint.Name, foundVideo.CuePoints.First().Name);
            Assert.AreEqual(cuePoint.Time, foundVideo.CuePoints.First().Time);
            Assert.AreEqual(cuePoint.Type, foundVideo.CuePoints.First().Type);
        }
Exemple #14
0
        public void FindAllVideos_Test_Sort()
        {
            _videos = _api.FindAllVideos(10, 0, SortBy.CreationDate);
            Assert.AreEqual(10, _videos.Count);

            // verify each video's creation date is in order
            BrightcoveVideo lastVideo = null;

            foreach (BrightcoveVideo bcVideo in _videos)
            {
                if (lastVideo == null)
                {
                    lastVideo = bcVideo;
                    continue;
                }
                Assert.LessOrEqual(lastVideo.CreationDate, bcVideo.CreationDate);
                lastVideo = bcVideo;
            }
        }
        public void CreateVideo_VideoFullLength()
        {
            BrightcoveVideo video = new BrightcoveVideo();

            video.Name             = "Test Video Creation: RemoteUrl";
            video.ReferenceId      = "test-reference-id";
            video.ShortDescription = "Test video, created via the API. Video is from the Creative Commons: http://creativecommons.org/videos/building-on-the-past";
            video.VideoFullLength  = new BrightcoveRendition
            {
                RemoteUrl      = "http://blip.tv/file/get/Commonscreative-BuildingOnThePast896.mov",
                ControllerType = ControllerType.Default,
                VideoCodec     = VideoCodec.H264
            };

            DeleteExisting(video.ReferenceId);

            long newId = _api.CreateVideo(video);

            Assert.That(newId, Is.GreaterThan(0));
        }
Exemple #16
0
        public void FindAllVideos_Test_SortOrder()
        {
            _videos = _api.FindAllVideos(10, 0, SortBy.CreationDate, SortOrder.Descending);
            Assert.AreEqual(10, _videos.Count);

            BrightcoveItemCollection <BrightcoveVideo> videos = _api.FindAllVideos(10, 0, SortBy.PlaysTotal, SortOrder.Descending);

            // verify each video's creation date is in order
            BrightcoveVideo lastVideo = null;

            foreach (BrightcoveVideo bcVideo in _videos)
            {
                if (lastVideo == null)
                {
                    lastVideo = bcVideo;
                    continue;
                }
                Assert.GreaterOrEqual(lastVideo.CreationDate, bcVideo.CreationDate);
                lastVideo = bcVideo;
            }
        }
        public void Sort_Videos_By_Creation_Date_Desc_No_Parameters()
        {
            // Perform the API call
            BrightcoveItemCollection <BrightcoveVideo> videos = Api.SearchVideos(new List <FieldValuePair>(),
                                                                                 new List <FieldValuePair>(),
                                                                                 new List <FieldValuePair>(),
                                                                                 100,
                                                                                 0,
                                                                                 false,
                                                                                 SortBy.CreationDate,
                                                                                 SortOrder.Descending);

            BrightcoveVideo firstVideo         = videos.First();
            BrightcoveVideo expectedFirstVideo = AllVideos.OrderByDescending(x => x.CreationDate)
                                                 .First();
            BrightcoveVideo lastVideoOnPage          = videos.Last();
            BrightcoveVideo expectedLastVideoInRange = AllVideos.OrderByDescending(x => x.CreationDate)
                                                       .Skip(videos.PageSize - 1)
                                                       .First();

            Assert.AreEqual(videos.TotalCount, AllVideos.Count);
            Assert.AreEqual(expectedFirstVideo.Id, firstVideo.Id);
        }
Exemple #18
0
 /// <summary>
 /// Creates a new video by uploading a file.
 /// </summary>
 /// <param name="video">The metadata for the video you want to create.</param>
 /// <param name="fileToUpload">The full path to the file to be uploaded.</param>
 /// <param name="encodeTo">If the file requires transcoding, use this parameter to specify the target encoding.
 /// Valid values are MP4 or FLV, representing the H264 and VP6 codecs respectively. Note that transcoding of
 /// FLV files to another codec is not currently supported. This parameter is optional and defaults to FLV.</param>
 /// <returns>The numeric ID of the newly created video.</returns>
 public long CreateVideo(BrightcoveVideo video, string fileToUpload, EncodeTo encodeTo)
 {
     return(CreateVideo(video, fileToUpload, encodeTo, true));
 }
        public void Sort_Videos_Test_All_Sort_By_Sort_Order_Overloads()
        {
            // Perform the API calls
            List <BrightcoveItemCollection <BrightcoveVideo> > collections = new List <BrightcoveItemCollection <BrightcoveVideo> >
            {
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>()
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    SortBy.CreationDate,
                    SortOrder.Ascending
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    SortBy.CreationDate,
                    SortOrder.Ascending,
                    null
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    SortBy.CreationDate,
                    SortOrder.Ascending,
                    null,
                    null
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    SortBy.CreationDate,
                    SortOrder.Ascending,
                    null,
                    null,
                    true
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    new SortedFieldDictionary(SortBy.CreationDate, SortOrder.Ascending)
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    new SortedFieldDictionary(SortBy.CreationDate, SortOrder.Ascending),
                    null
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    new SortedFieldDictionary(SortBy.CreationDate, SortOrder.Ascending),
                    null,
                    null
                ),
                Api.SearchVideos
                (
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    new List <FieldValuePair>(),
                    100,
                    0,
                    false,
                    new SortedFieldDictionary(SortBy.CreationDate, SortOrder.Ascending),
                    null,
                    null,
                    true
                )
            };

            foreach (var videos in collections)
            {
                BrightcoveVideo firstVideo         = videos.First();
                BrightcoveVideo expectedFirstVideo = AllVideos.OrderBy(x => x.CreationDate)
                                                     .First();
                BrightcoveVideo lastVideoOnPage          = videos.Last();
                BrightcoveVideo expectedLastVideoInRange = AllVideos.OrderBy(x => x.CreationDate)
                                                           .Skip(videos.PageSize - 1)
                                                           .First();

                Assert.AreEqual(expectedFirstVideo.Id, firstVideo.Id);
                Assert.AreEqual(expectedLastVideoInRange.Id, lastVideoOnPage.Id);
            }
        }
Exemple #20
0
        public void FindVideoByRefId_Renditions()
        {
            BrightcoveVideo video = _api.FindVideoByReferenceId(_refId);

            Assert.Greater(video.Renditions.Count, 0);
        }
Exemple #21
0
 /// <summary>
 /// Creates a new video using a remote URL rendition.  The remote URL should be set
 /// in the video renditions.
 /// </summary>
 /// <param name="video">The metadata for the video you want to create.</param>
 public long CreateVideo(BrightcoveVideo video)
 {
     return(CreateVideo(video, (FileUploadInfo)null, EncodeTo.None, false, false, false));
 }
Exemple #22
0
        public void FindVideoByRefId_IOSRenditions()
        {
            BrightcoveVideo video = _api.FindVideoByReferenceId(_refId, new[] { "IOSRenditions" });

            Assert.Greater(video.IOSRenditions.Count, 0);
        }
Exemple #23
0
        public void FindVideoByRefId_DigitalMaster()
        {
            BrightcoveVideo video = _api.FindVideoByReferenceId(_refId, new[] { "digitalMaster" });

            Assert.IsNotNull(video.DigitalMaster);
        }
Exemple #24
0
 /// <summary>
 /// Creates a new video by uploading a file.
 /// </summary>
 /// <param name="video">The metadata for the video you want to create.</param>
 /// <param name="fileToUpload">The full path to the file to be uploaded.</param>
 /// <returns>The numeric ID of the newly created video.</returns>
 public long CreateVideo(BrightcoveVideo video, string fileToUpload)
 {
     return(CreateVideo(video, fileToUpload, EncodeTo.None));
 }
Exemple #25
0
 /// <summary>
 /// Creates a new video by uploading a file.
 /// </summary>
 /// <param name="video">The metadata for the video you want to create.</param>
 /// <param name="fileToUpload">The full path to the file to be uploaded.</param>
 /// <param name="encodeTo">If the file requires transcoding, use this parameter to specify the target encoding.
 /// Valid values are MP4 or FLV, representing the H264 and VP6 codecs respectively. Note that transcoding of
 /// FLV files to another codec is not currently supported. This parameter is optional and defaults to FLV.</param>
 /// <param name="createMultipleRenditions">If the file is a supported transcodeable type, this optional flag can be
 /// used to control the number of transcoded renditions. If true (default), multiple renditions at varying encoding
 /// rates and dimensions are created. Setting this to false will cause a single transcoded VP6 rendition to be created
 /// at the standard encoding rate and dimensions.</param>
 /// <returns>The numeric ID of the newly created video.</returns>
 public long CreateVideo(BrightcoveVideo video, string fileToUpload, EncodeTo encodeTo, bool createMultipleRenditions)
 {
     return(CreateVideo(video, fileToUpload, encodeTo, createMultipleRenditions, false));
 }