2015-06-26 63 views

回答

1

要創建縮略圖,您應該照常創建一個作業,但通過setConfiguration設置縮略圖xml。

這是未經測試的代碼,但應該工作。

// sets the thumbnail configuration 
$thumbnailConfig = <<<EOT 
<?xml version="1.0" encoding="utf-8"?> 
<Thumbnail Size="50%,*" Type="Jpeg" Filename="{OriginalFilename}_{Size}_{ThumbnailTime}_{ThumbnailIndex}_{Date}_{Time}.{DefaultExtension}"> 
<Time Value="10%"/> 
</Thumbnail> 
EOT; 

$xmlTask = '<taskBody><inputAsset>JobInputAsset(0)</inputAsset>' 
     . '<outputAsset>JobOutputAsset(0)</outputAsset></taskBody>'; 

$mediaProcessor = $restProxy->getLatestMediaProcessor('Azure Media Encoder'); 

$task = new Task($xmlTask, $mediaProcessor->getId(), TaskOptions::NONE); 
$task->setConfiguration($thumbnailConfig); 

$restProxy->createJob(new Job(), array($inputAsset), array($task)); 

您應該連接到媒體服務第一,更多信息請here

連接片段:

$restProxy = ServicesBuilder->getInstance()->createMediaServicesService(
      new MediaServicesSettings([YourAccountName], 
          [YourPrimaryOrSecondaryAccessKey])); 
相關問題