MediaTailor 使用 的範例 AWS CLI - AWS Command Line Interface

本文件 AWS CLI 僅適用於 的第 1 版。如需與 第 2 版相關的文件 AWS CLI,請參閱 第 2 版使用者指南

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

MediaTailor 使用 的範例 AWS CLI

下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 來執行動作和實作常見案例 MediaTailor。

Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會示範如何呼叫個別服務函數,但您可以在相關案例中查看內容中的動作。

每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。

主題

動作

下列程式碼範例示範如何使用 delete-playback-configuration

AWS CLI

刪除組態

下列 會delete-playback-configuration刪除名為 的組態campaign_short

aws mediatailor delete-playback-configuration \ --name campaign_short

此命令不會產生輸出。

如需詳細資訊,請參閱 AWS 元素 MediaTailor 使用者指南 中的刪除組態

下列程式碼範例示範如何使用 get-playback-configuration

AWS CLI

描述組態

下列get-playback-configuration顯示名為 之組態的所有詳細資訊west_campaign

aws mediatailor get-playback-configuration \ --name west_campaign

輸出:

{ "AdDecisionServerUrl": "http://your.ads.url", "CdnConfiguration": {}, "DashConfiguration": { "ManifestEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com/v1/dash/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/west_campaign/", "MpdLocation": "EMT_DEFAULT", "OriginManifestType": "MULTI_PERIOD" }, "HlsConfiguration": { "ManifestEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com/v1/master/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/west_campaign/" }, "Name": "west_campaign", "PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/west_campaign", "PlaybackEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com", "SessionInitializationEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com/v1/session/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/west_campaign/", "Tags": {}, "VideoContentSourceUrl": "https://8343f7014c0ea438.mediapackage.us-west-2.amazonaws.com/out/v1/683f0f2ff7cd43a48902e6dcd5e16dcf/index.m3u8" }

如需詳細資訊,請參閱 AWS 元素 MediaTailor 使用者指南 中的檢視組態

下列程式碼範例示範如何使用 list-playback-configurations

AWS CLI

列出所有組態

下列list-playback-configurations顯示目前 AWS 帳戶上組態的所有詳細資訊。

aws mediatailor list-playback-configurations

輸出:

{ "Items": [ { "AdDecisionServerUrl": "http://your.ads.url", "CdnConfiguration": {}, "DashConfiguration": { "ManifestEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com/v1/dash/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/west_campaign/", "MpdLocation": "EMT_DEFAULT", "OriginManifestType": "MULTI_PERIOD" }, "HlsConfiguration": { "ManifestEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com/v1/master/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/west_campaign/" }, "Name": "west_campaign", "PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/west_campaign", "PlaybackEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com", "SessionInitializationEndpointPrefix": "https://170c14299689462897d0cc45fc2000bb.mediatailor.us-west-2.amazonaws.com/v1/session/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/west_campaign/", "Tags": {}, "VideoContentSourceUrl": "https://8343f7014c0ea438.mediapackage.us-west-2.amazonaws.com/out/v1/683f0f2ff7cd43a48902e6dcd5e16dcf/index.m3u8" }, { "AdDecisionServerUrl": "http://your.ads.url", "CdnConfiguration": {}, "DashConfiguration": { "ManifestEndpointPrefix": "https://73511f91d6a24ca2b93f3cf1d7cedd67.mediatailor.us-west-2.amazonaws.com/v1/dash/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/sports_campaign/", "MpdLocation": "DISABLED", "OriginManifestType": "MULTI_PERIOD" }, "HlsConfiguration": { "ManifestEndpointPrefix": "https://73511f91d6a24ca2b93f3cf1d7cedd67.mediatailor.us-west-2.amazonaws.com/v1/master/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/sports_campaign/" }, "Name": "sports_campaign", "PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/sports_campaign", "PlaybackEndpointPrefix": "https://73511f91d6a24ca2b93f3cf1d7cedd67.mediatailor.us-west-2.amazonaws.com", "SessionInitializationEndpointPrefix": "https://73511f91d6a24ca2b93f3cf1d7cedd67.mediatailor.us-west-2.amazonaws.com/v1/session/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/sports_campaign/", "SlateAdUrl": "http://s3.bucket/slate_ad.mp4", "Tags": {}, "VideoContentSourceUrl": "https://c4af3793bf76b33c.mediapackage.us-west-2.amazonaws.com/out/v1/1dc6718be36f4f34bb9cd86bc50925e6/sports_endpoint/index.m3u8" } ] }

如需詳細資訊,請參閱 AWS 元素 MediaTailor 使用者指南 中的檢視組態<https://docs.aws.amazon.com/mediatailor/latest/ug/configurations-view.html>。

下列程式碼範例示範如何使用 put-playback-configuration

AWS CLI

建立組態

下列會put-playback-configuration建立名為 的組態campaign_short

aws mediatailor put-playback-configuration \ --name campaign_short \ --ad-decision-server-url http://your.ads.url \ --video-content-source-url http://video.bucket/index.m3u8

輸出:

{ "AdDecisionServerUrl": "http://your.ads.url", "CdnConfiguration": {}, "DashConfiguration": { "ManifestEndpointPrefix": "https://13484114d38f4383bc0d6a7cb879bd00.mediatailor.us-west-2.amazonaws.com/v1/dash/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/campaign_short/", "MpdLocation": "EMT_DEFAULT", "OriginManifestType": "MULTI_PERIOD" }, "HlsConfiguration": { "ManifestEndpointPrefix": "https://13484114d38f4383bc0d6a7cb879bd00.mediatailor.us-west-2.amazonaws.com/v1/master/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/campaign_short/" }, "Name": "campaign_short", "PlaybackConfigurationArn": "arn:aws:mediatailor:us-west-2:123456789012:playbackConfiguration/campaign_short", "PlaybackEndpointPrefix": "https://13484114d38f4383bc0d6a7cb879bd00.mediatailor.us-west-2.amazonaws.com", "SessionInitializationEndpointPrefix": "https://13484114d38f4383bc0d6a7cb879bd00.mediatailor.us-west-2.amazonaws.com/v1/session/1cbfeaaecb69778e0c167d0505a2bc57da2b1754/campaign_short/", "Tags": {}, "VideoContentSourceUrl": "http://video.bucket/index.m3u8" }

如需詳細資訊,請參閱 AWS 元素 MediaTailor 使用者指南 中的建立組態