簡介
有兩個與之相關的API 雲播放:
- EPG API使您可以檢索Cloud Playout頻道的電子編程指南。 Cloud Playout生成遵循XML TV標準的EPG,如以下網址中的架構所述 https://repository.data2type.de/XMLTV/v_1.47/html/index.html.
- 通過Channels API,您可以檢索有關Cloud Playout通道的信息,這些信息可以顯示在UI或網頁中。
認證
Cloud Playout API使用 Brightcove OAuth系統 通過與請求一起在授權標頭中傳遞的訪問令牌對請求進行身份驗證:
Authorization: Bearer {access token}
訪問令牌是使用檢索的 OAuth API -看 獲取訪問令牌 有關詳細信息。 您還將需要客戶端憑據來認證對訪問令牌的請求。 這些可以在Studio的“管理”部分中創建-請參見 管理API憑證。 您的憑據需要的EPG API權限為:

API URL
獲取所有Cloud Playout頻道
以下端點可用於獲取帳戶的所有Cloud Playout頻道的列表:
https://cm.cloudplayout.brightcove.com/accounts/{account_id}/cp_channels
account_id
是 Video Cloud 帳戶ID。
取得EPG
EPG API請求的URL是:
https://sm.cloudplayout.brightcove.com/accounts/{account_id}/channels/{channel_id}/epg
account_id
是 Video Cloud 帳戶ID和 channel_id
是在Studio中創建的頻道的ID。
您可以在獲取所有Cloud Playout頻道的請求響應中找到頻道ID,也可以在Studio的Cloud Playout部分的Channel視圖中的瀏覽器URL中找到頻道ID:
https://studio.brightcove.com/products/videocloud/cloudplayout/channel/2c73c2112f794e6eb80be1284a495674
EPG請求參數
可以將以下可選查詢參數添加到EPG請求中:
參數 | 默認值 | 產品描述 |
---|---|---|
start |
(現在14天之前) | 可以查詢EPG響應並以ISO 8601日期格式返回的日期時間 |
end |
(現在-當前日期時間) | 可以查詢並返回ISO 8601日期格式的EPG響應的日期時間。 |
limit |
(所有程序) | 一個整數值,控制一個請求中返回的程序數 |
include_ads |
假 | 將此屬性設置為true可在響應中包含廣告 |
筆記
-
start
/end
窗口不能超過14天。 開始時間可能比當前日期晚14天,以查詢歷史EPG。 您還可以將EPG數據從當前日期時間起最多保留14天。 - 如果結束時間和開始時間之間的差值大於14天,則API從請求的時間到結束時間僅生成14天或14天(以較早者為準)。
- 多模
start
以及end
可以接受帶有和不帶有時區偏移量的日期時間值-如果不包括時區偏移量,則採用UTC。 -
多模
start
以及end
必須使用URI編碼:URI編碼 ISO 8601樣本 URI編碼 2020-07-24 15:30:00
2020-07-24%2015%3A30%3A00
2020-07-24 15:30:00 +0530
2020-07-24%2015%3A30%3A00%20%2B0530
示例EPG API響應
以下是來自API的示例響應:
<?xml version="1.0" encoding="utf-8"?>
<tv source-info-name="Cloudplayout Schedules" source-info-url="http://www.cloudplayout.qa.brightcove.com">
<channel id="9fb8032ff2fe4f55b388d8969c22ca58">
<display-name>MyCloudChannel</display-name>
<icon src="https://bc-cloudplayout-prod.s3.amazonaws.com/default_channel_image.png"/>
</channel>
<programme channel="9fb8032ff2fe4f55b388d8969c22ca58" start="20201120132000" stop="20201120132228">
<title>Frozen</title>
<desc>FrozenMultiLanguage</desc>
<length units="seconds">147.605</length>
<icon src="https://cf-images.us-east-1.qa.boltdns.net/v1/jit/6063799219001/43d57501-b98a-4708-bdd1-a09081f7a585/main/1280x720/1m13s802ms/match/image.jpg" width="1280" height="720"/>
<category>video</category>
<keyword>eyJ2aWRlb19pZCI6IjcwNzAwNDQxMDk2MjAyIiwib3JkZXIiOjEsInRhZ3MiOiJjaGlsZHJlbixjb21lZHkiLCJjdXN0b21fbWV0YWRhdGEiOnsicmVnaW9uIjoiYWZyaWNhIiwic29uZ3MiOjV9fQ==</keyword>
</programme>
<programme channel="9fb8032ff2fe4f55b388d8969c22ca58" start="20201120132228" stop="20201120133228">
<title>LiveDemo</title>
<desc>Live Demo</desc>
<length units="seconds">600.0</length>
<icon src="https://img.brightcove.com/cloudplayout/live-icon.jpg" width="1280" height="720"/>
<category>live</category>
<keyword>eyJ2aWRlb19pZCI6IjcwNzAxNDg0MjA3MjAyIiwib3JkZXIiOjIsInRhZ3MiOiJjcC1saXZlLXBsYWNlaG9sZGVyLGR1cmF0aW9uLTAwOjEwOjAwIiwiY3VzdG9tX21ldGFkYXRhIjp7InJlZ2lvbiI6Im5vcnRoIGFtZXJpY2EifX0=</keyword>
</programme>
<programme channel="9fb8032ff2fe4f55b388d8969c22ca58" start="20201120133228" stop="20201120133327">
<title>ChildrenComedy</title>
<desc>ChildrenComedy</desc>
<length units="seconds">59.164</length>
<icon src="https://cf-images.us-east-1.qa.boltdns.net/v1/jit/6063799219001/9430773f-76f5-476e-964d-a13b40cab90a/main/1280x720/29s582ms/match/image.jpg" width="1280" height="720"/>
<category>video</category>
<keyword>eyJ2aWRlb19pZCI6IjcwNzAxMjE2NDgyMjAyIiwib3JkZXIiOjMsInRhZ3MiOiJyb21hbmNlIiwiY3VzdG9tX21ldGFkYXRhIjp7InJlZ2lvbiI6ImFzaWEiLCJzb25ncyI6NX19</keyword>
</programme>
<programme>
...
</programme>
</tv>
筆記
- 開始和結束時間戳記為UTC時間。
-
category
以及keyword
條目僅供內部使用。
EPG數據包含多個節目數據,其中每個節目代表有關視頻或 live 資產:
<programme channel="27963aa756294a7c98ca1c2c459d4ba2" start="20201118232206" stop="20201118232305">
<title>ChildrenComedy</title>
<desc>ChildrenComedy</desc>
<length> units="seconds">59.164</length>
<icon> src="https://cf-images.us-east-1.qa.boltdns.net/v1/jit/6063799219001/9430773f-76f5-476e-964d-a13b40cab90a/main/1280x720/29s582ms/match/image.jpg" width="1280" height="720" ></icon>
<category>video</category>
<keyword>eyJ2aWRlb19pZCI6IjcwNzAxMjE2NDgyMjAyIiwib3JkZXIiOjEsInRhZ3MiOiJjaGlsZHJlbixjb21lZHkiLCJjdXN0b21fbWV0YWRhdGEiOnsicmVnaW9uIjoiYWZyaWNhIiwic29uZ3MiOjV9fQ==</keyword>
</programme>
在這裡, keyword
包含base64編碼的json值。 的解碼值 keyword
如下所示。
video_id
:是視頻的標識符,如 Video Cloud.order
:是Cloud Playout程序列表中資產的順序。tags
:逗號分隔(如果有的話)-與對應的視頻 video cloud.- 自定義元數據:(如果有的話,表示為名稱/值對)與以下視頻中的相應視頻相關聯 video cloud.
{
"video_id":"70701216482202",
"order":1,
"tags":"children,comedy",
"custom_metadata":{
"region":"africa",
"songs":5
}
}
樣本通道API響應
{
"items": [
{
"public_id": "f8eb5f9ccfb84f81b4fb506a663c5545",
"name": "Channel-4",
"description": "Test Channel",
"account_id": "1752604059001",
"state": "RUNNING",
"status": "Channel started",
"start_time": "2021-01-03 15:31:12 UTC",
"stop_time": null,
"input_groups": "slate:rtmp:playlist",
"output_groups": "rtmp",
"loop_playlist": true,
"playlist_id": "1687789969630819284",
"channel_class": "single-pipeline",
"ssai_enabled": false,
"aws_region": "us-east-1",
"message": "",
"created_at": "2021-01-02 15:39:05 UTC",
"updated_at": "2021-01-03 15:31:12 UTC",
"image_url": "https://bc-cloudplayout-prod.s3.amazonaws.com/default_channel_image.png",
"output_destinations": [
"Brightcove Live"
],
"channel_created_at": "2021-01-02 15:39:05 UTC",
"channel_updated_at": "2021-01-02 15:39:05 UTC",
"channel_created_by": "rcrooks@brightcove.com",
"channel_updated_by": "rcrooks@brightcove.com"
},
{
"public_id": "42ecb67a9a964662a4071b4fffff0012",
"name": "Test-6",
"description": "Test Channel",
"account_id": "1752604059001",
"state": "SCHEDULED",
"status": "Scheduled for start",
"start_time": "2021-01-09 05:00:00 UTC",
"stop_time": "2021-01-09 23:00:00 UTC",
"input_groups": "slate:rtmp:playlist",
"output_groups": "rtmp",
"loop_playlist": true,
"playlist_id": "1688070644726417934",
"channel_class": "single-pipeline",
"ssai_enabled": false,
"aws_region": "us-east-1",
"message": "",
"created_at": "2021-01-05 18:00:18 UTC",
"updated_at": "2021-01-06 19:08:41 UTC",
"image_url": "https://bc-cloudplayout-prod.s3.amazonaws.com/default_channel_image.png",
"output_destinations": [
"Brightcove Live"
],
"channel_created_at": "2021-01-05 18:00:18 UTC",
"channel_updated_at": "2021-01-06 19:06:46 UTC",
"channel_created_by": "rcrooks@brightcove.com",
"channel_updated_by": "rcrooks@brightcove.com"
}
]
}
限制
- EPG是盡力而為/接近準確而生成的。
- 從播放列表最初構建EPG時,可能會出現開始時間錯誤,因為Cloud Playout需要一些時間來啟動切換。
- 修改播放列表時,EPG可能對每次檢索都不一致,因為它是根據所保存的當前信息動態構建的。 某些會改變EPG的操作包括重新排序播放列表或在播放列表中添加/刪除資產。
- 如果在切換中發生任何故障並且切換時間不正確,則對於將來的EPG可能存在運輸不准確的情況。 可能導致此情況的操作示例包括播放列表切換或刪除播放列表中的當前活動資產。
- EPG的消費者應該要求它盡可能接近實時,以獲取最準確的版本。