public InStreamVideoCreative replaceInStreamAsset(string assetName, InStreamAssetUploadRequest assetReplaceRequest) { object[] results = this.Invoke("replaceInStreamAsset", new object[] {assetName, assetReplaceRequest}); return ((InStreamVideoCreative) (results[0])); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The Dfa user object running the code example. /// </param> public override void Run(DfaUser user) { // Request the creative service from the service client factory. CreativeRemoteService creativeService = (CreativeRemoteService) user.GetService( DfaService.v1_20.CreativeRemoteService); string assetName = _T("INSERT_ASSET_NAME_HERE"); string pathToFile = _T("INSERT_PATH_TO_FILE_HERE"); long creativeId = long.Parse(_T("INSERT_IN_STREAM_VIDEO_CREATIVE_ID_HERE")); string assetToReplace = _T("INSERT_ASSET_TO_REPLACE_HERE"); // Create the In-Stream creative asset. CreativeAsset inStreamVideoAsset = new CreativeAsset(); inStreamVideoAsset.name = assetName; inStreamVideoAsset.content = MediaUtilities.GetAssetDataFromUrl( new Uri(pathToFile).AbsoluteUri); // Create an upload request to make this asset a companion ad file for an // existing In-Stream video creative. InStreamAssetUploadRequest inStreamAssetUploadRequest = new InStreamAssetUploadRequest(); inStreamAssetUploadRequest.companion = true; inStreamAssetUploadRequest.inStreamAsset = inStreamVideoAsset; inStreamAssetUploadRequest.creativeId = creativeId; try { // Replace the existing asset with a newly uploaded asset. InStreamVideoCreative inStreamVideoCreative = creativeService.replaceInStreamAsset(assetToReplace, inStreamAssetUploadRequest); // Display a success message. Console.WriteLine("Replaced companion ad asset \"{0}\" in In-Stream video creative " + "with ID \"{1}\".%n", assetToReplace, inStreamVideoCreative.id); } catch (Exception ex) { Console.WriteLine("Failed to replace companion ad asset in in-stream video creative. " + "Exception says \"{0}\"", ex.Message); } }
public InStreamVideoCreative uploadInStreamAsset(InStreamAssetUploadRequest assetUploadRequest) { object[] results = this.Invoke("uploadInStreamAsset", new object[] {assetUploadRequest}); return ((InStreamVideoCreative) (results[0])); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The Dfa user object running the code example. /// </param> public override void Run(DfaUser user) { // Request the creative service from the service client factory. CreativeRemoteService creativeService = (CreativeRemoteService) user.GetService( DfaService.v1_20.CreativeRemoteService); string assetName = _T("INSERT_ASSET_NAME_HERE"); string pathToFile = _T("INSERT_PATH_TO_FILE_HERE"); long creativeId = long.Parse(_T("INSERT_IN_STREAM_VIDEO_CREATIVE_ID_HERE")); // Create the In-Stream video creative asset. CreativeAsset inStreamVideoAsset = new CreativeAsset(); inStreamVideoAsset.name = assetName; inStreamVideoAsset.content = MediaUtilities.GetAssetDataFromUrl( new Uri(pathToFile).AbsolutePath); // Create an upload request to make this asset a media file for an existing // In-Stream creative. InStreamAssetUploadRequest inStreamAssetUploadRequest = new InStreamAssetUploadRequest(); inStreamAssetUploadRequest.mediaFile = true; inStreamAssetUploadRequest.inStreamAsset = inStreamVideoAsset; inStreamAssetUploadRequest.creativeId = creativeId; try { // Save the media file. InStreamVideoCreative inStreamVideoCreative = creativeService.uploadInStreamAsset(inStreamAssetUploadRequest); // Display a success message. Console.WriteLine("Added a media file to In-Stream video creative with ID \"{0}\".", inStreamVideoCreative.id); } catch (Exception ex) { Console.WriteLine("Failed to add a media file to in-stream video creative. " + "Exception says \"{0}\"", ex.Message); } }