/// <summary>
		/// Creates a new audio track in Brightcove by uploading a file.
		/// </summary>
		/// <param name="audioTrack">The audio track to create</param>
		/// <param name="fileToUpload">The full path to the file to be uploaded.</param>
		/// <returns>The numeric ID of the uploaded track</returns>
		public long CreateAudioTrack(BrightcoveAudioTrack audioTrack, string fileToUpload)
		{
			using (FileStream fs = File.OpenRead(fileToUpload))
			{
				string fileName = new FileInfo(fileToUpload).Name;
				return CreateAudioTrack(audioTrack, new FileUploadInfo(fs, fileName));
			}
		}
		/// <summary>
		/// Creates a new audio track in Brightcove by uploading a file.
		/// </summary>
		/// <param name="audioTrack">The audio track to create</param>
		/// <param name="fileToUpload">The full path to the file to be uploaded.</param>
		/// <returns>The numeric ID of the uploaded track</returns>
		public long CreateAudioTrack(BrightcoveAudioTrack audioTrack, string fileToUpload)
		{
			string fileName;
			byte[] fileBytes;
			GetFileUploadInfo(fileToUpload, out fileName, out fileBytes);

			return CreateAudioTrack(audioTrack, fileName, fileBytes);
		}
		public void UpdateAudioTrackInformation_Test_Basic()
		{
			BrightcoveAudioTrack audioTrack = new BrightcoveAudioTrack();
			audioTrack.ReferenceId = AudioTrack.ReferenceId;
			audioTrack.ShortDescription = RandomString(20);
			audioTrack.LongDescription = RandomString(200);
			audioTrack.Name = "Gabe Test 467";

			BrightcoveAudioTrack result = Api.UpdateAudioTrack(audioTrack);

			Assert.AreEqual(audioTrack.ShortDescription, result.ShortDescription);
			Assert.AreEqual(audioTrack.LongDescription, result.LongDescription);
			Assert.AreEqual(audioTrack.Name, result.Name);
		}
		/// <summary>
		/// Creates a new audio track in Brightcove by uploading a file.
		/// </summary>
		/// <param name="audioTrack">The audio track to create</param>
        /// <param name="fileToUpload">The full path to the file to be uploaded.</param>
		/// <returns>The numeric ID of the uploaded track</returns>
		public long CreateAudioTrack(BrightcoveAudioTrack audioTrack, string fileToUpload)
		{
			BrightcoveParamCollection parms = CreateWriteParamCollection("create_audiotrack",
																		 methodParams => methodParams.Add("audiotrack", audioTrack));
			return RunFilePost<BrightcoveResultContainer<long>>(parms, fileToUpload).Result;
		}
		/// <summary>
		/// Updates the audio track information for a Brightcove audio track.
		/// </summary>
		/// <param name="audioTrack"></param>
		/// <returns>The updated BrightcoveAudioTrack</returns>
		public BrightcoveAudioTrack UpdateAudioTrack(BrightcoveAudioTrack audioTrack)
		{
			BrightcoveParamCollection parms = CreateWriteParamCollection("update_audiotrack",
																		 methodParams => methodParams.Add("audiotrack", audioTrack));
			return RunPost<BrightcoveResultContainer<BrightcoveAudioTrack>>(parms).Result;
		}
Ejemplo n.º 6
0
 public void TestFixtureSetUp()
 {
     Api = BrightcoveApiFactory.CreateApi(ApiKeys.ReadToken, ApiKeys.WriteToken);
     // Find a random audio track.
     AudioTrack = Api.FindAllAudioTracks(1, 0).FirstOrDefault();
 }