Пример #1
0
        public Int64 processVideo(VideoProcessQuery query)
        {
            var url  = apiUrl + "/api/videos";
            var data = "<vzaar-api><video>";

            if (query.replaceId != "")
            {
                data += "<replace_id>" + query.replaceId + "</replace_id>";
            }
            data += "<guid>" + query.guid + "</guid><title>" + query.title + "</title><description>" + query.description + "</description><labels>";
            data += String.Join(",", query.labels) + "</labels><profile>" + query.profile + "</profile>";
            if (query.transcode)
            {
                data += "<transcoding>true</transcoding>";
            }
            data += "</video> </vzaar-api>";

            var response = executeRequest(url, "POST", data);

            var doc = new XmlDocument();

            doc.LoadXml(response);
            var videoId = Int64.Parse(doc.SelectSingleNode("//video").InnerText);

            return(videoId);
        }
Пример #2
0
 public void deleteVideoTest() {
    var guid = this.api.uploadVideo("./examples/video.mp4");
    var query = new VideoProcessQuery {
     guid = guid,
     title = "for deletion",
     description = ".net api test",
     profile = VideoProfile.ORIGINAL
   };
   var vidId = this.api.processVideo(query);
   var res = this.api.deleteVideo(vidId);
   this.assertEqual(res, true, "videoDelete");
 }
Пример #3
0
        public Int64 processVideo ( VideoProcessQuery query )
        {
            var url = apiUrl + "/api/v1.1/videos";
            var data = "<vzaar-api><video>";
            if (query.replaceId != "")
                data += "<replace_id>" + query.replaceId + "</replace_id>";
            data += "<guid>" + query.guid + "</guid><title>" + HttpUtility.HtmlEncode(query.title) + "</title><description>" + HttpUtility.HtmlEncode(query.description) + "</description><labels>";
            data += HttpUtility.HtmlEncode(String.Join( ",", query.labels )) + "</labels><profile>" + (int)query.profile + "</profile>";
            if (query.chunks > 0)
            {
                data += "<chunks>" + query.chunks + "</chunks>";
            }
            if (query.transcode)
                data += "<transcoding>true</transcoding>";
            data += "</video> </vzaar-api>";

            var response = executeRequest( url, "POST", data );

            var doc = new XmlDocument();
            doc.LoadXml( response );
            var videoId = Int64.Parse( doc.SelectSingleNode( "//video" ).InnerText );

            return videoId;
        }
Пример #4
0
//    public void editVideoTest() {
//      var query = new VideoEditQuery {
//        title = this.RandomString(7),
//        id = this.videoId
//      };
//      var res = this.api.editVideo(query);
//      this.assertEqual(res, true, "editVideo");
//    }


    public void videoUploadTest() {
      var guid = this.api.uploadVideo("./examples/video.mp4");
      var title = String.Concat("api-net-", this.RandomString(5));

      var query = new VideoProcessQuery {
        guid = guid,
        title = title,
        description = ".net api test",
        profile = VideoProfile.ORIGINAL
      };
      var vidId = this.api.processVideo(query);
      var vid = this.api.getVideoDetails(vidId);

      this.assertEqual(vid.videoStatus.id, 11, "videoUpload");

      // clean up
      this.api.deleteVideo(vidId);
    }