支持 聯繫支持 | 系統狀況 系統狀態

概述: Playback API

Playback API 用於從中獲取視頻和播放列表數據 Video Cloud。 通常用於將視頻數據傳輸到 player 在網頁上或在移動應用中。

簡介

Playback API 是低延遲API,供客戶端從網頁或移動應用中獲取視頻或播放列表數據時使用。 它是 用於集成的通用媒體管理API Video Cloud 與CMS或其他系統配合使用-為此,您應該使用 CMS API.

Playback API 結果被過濾為僅返回可播放的視頻(狀態=有效,提取完成標誌=真,並且按計劃在正確的數據/時間內)。 這意味著 player 只要有一個副本,即使其他副本仍在處理中,也將能夠播放視頻。 如果您需要獲取當前無法播放的視頻,則應再次使用 CMS API 代替。

還請注意,為了最大限度地提高性能, Playback API 緩存了很短的時間。 特定數據集ID緩存的時間長短會有所不同,但可能長達20分鐘。

另見 API參考.

用例

Brightcove PlayerBrightcove SDK players 包括與方法相同的目錄方法 Playback API,並且在大多數情況下,如果您只是在運行時檢索視頻或播放列表以進行播放,則可以簡單地使用它們。

但是,您可能希望在移動應用程序屏幕中提供視頻或播放列表的視圖,而沒有 player 存在。

此外,有時您可能想檢索視頻或播放列表以顯示有關它們的信息,而無需 player 在屏幕上,例如作為視頻門戶的登錄頁面。

Playback API 在這些情況下很有用。

一般信息

基本網址

的基本網址 Playback API 是:

        https://edge.api.brightcove.com/playback/v1

帳戶路徑

在所有情況下,都將針對特定 Video Cloud 帳戶。 因此,您將始終添加該詞 accounts 然後是您的帳戶ID和基本URL:

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}

認證

請求通過策略密鑰進行身份驗證,可以通過以下三種方式之一進行傳遞:

  1. 在爭論 Accept 標頭:
            Accept: application/json;pk={policy_key}

    對於基於瀏覽器的客戶端,這是推薦的方法,因為作為瀏覽器CORS“飛行前”檢查的一部分,它允許請求繼續進行而無需額外的請求。 這樣可以節省第一次發出瀏覽器請求時的延遲。

  2. Authorization 標頭使用realm關鍵字 BCOV-Policy:
            Authorization: BCOV-Policy {policy_key}
  3. BCOV-Policy 標頭:
            BCOV-Policy: {policy_key}

獲取策略密鑰

您可以通過三種方式獲取策略密鑰:

  1. 每個光明灣 player 被自動分配一個。 您可以找到有關獲取 player的政策密鑰 這個文件。 由於策略密鑰適用於整個帳戶,因此無論是否 player 嵌入在頁面上。
  2. 您可以使用 策略密鑰快速入門
  3. 您可以向 Policy API

令牌認證

支持HLS和DASH內容的令牌身份驗證。 如果您需要令牌認證,請與您的客戶經理聯繫,以為您的帳戶啟用它。

避免使用硬編碼的網址

縮略圖,海報,視頻文件和其他媒體的URL絕對不應在頁面或應用程序中進行硬編碼。 的 Playback API 將返回媒體文件URL的最新緩存版本,但URL本身可能會更改。 您應該使用 CMS API ( 要么 Playback API ),要求在每次頁面加載時檢索這些網址,或將其緩存不超過六個小時。

緩存視頻和圖像URL

您可以緩存視頻和圖像的URL以提高頁面性能,但是必須定期刷新緩存。 如果您緩存檢索到的URL以提高頁面性能,請確保至少每六個小時重複一次API調用來刷新緩存。

方法

API僅支持以下類型的以下GET請求:

影片要求

可以使用視頻ID或參考ID檢索單個視頻對象。

通過ID獲取視頻

端點

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/videos/{video_id}

        https://edge.api.brightcove.com/playback/v1/accounts/57838016001/videos/38467382999

樣品回复

        {
          "account_id": "107767373999",
          "ad_keys": null,
          "created_at": "2010-07-12T22:37:34.760Z",
          "description": "Avatar_MakingAScene_Featurette",
          "duration": 595560,
          "id": "38467382999",
          "long_description": null,
          "name": "Avatar_MakingAScene_Featurette",
          "published_at": "2010-07-12T22:37:34.760Z",
          "reference_id": "AvatarMakingShort",
          "text_tracks": [],
          "updated_at": "2010-07-12T22:54:29.666Z",
          "cue_points": [
            {
              "id": "111637107001",
              "name": "Pre-roll",
              "type": "AD",
              "time": 0,
              "metadata": null,
              "force_stop": false
            }
          ],
          "custom_fields": {
            "moretext": "this is the first video uploaded",
            "mylist": "abc"
          },
          "link": {
            "text": "Full Dvd at Amazon",
            "url": "http://www.amazon.com/Avatar-Sam-Worthington/dp/B002VPE1AW"
          },
          "tags": [
            "copied"
          ],
          "poster_sources": [
            {
              "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999"
            }
          ],
          "thumbnail_sources": [
            {
              "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999"
            }
          ],
          "poster": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999",
          "thumbnail": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999",
          "sources": [
            {
              "avg_bitrate": 379000,
              "width": 320,
              "duration": 595560,
              "size": 28196307,
              "stream_name": "mp4:107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
              "codec": "H264",
              "asset_id": "111728840001",
              "container": "MP4",
              "height": 180,
              "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
            },
            {
              "avg_bitrate": 379000,
              "width": 320,
              "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
              "size": 28196307,
              "height": 180,
              "duration": 595560,
              "container": "MP4",
              "codec": "H264",
              "asset_id": "111728840001"
            }, ... 6 more sources ...
    
          ]
        }

通過參考ID獲取視頻

端點

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/videos/ref:{reference_id}

        https://edge.api.brightcove.com/playback/v1/accounts/57838016001/videos/ref:nature_2010-07-12

樣品回复

        {
          "account_id": "107767373999",
          "ad_keys": null,
          "created_at": "2010-07-12T22:37:34.760Z",
          "description": "Avatar_MakingAScene_Featurette",
          "duration": 595560,
          "id": "38467382999",
          "long_description": null,
          "name": "Avatar_MakingAScene_Featurette",
          "published_at": "2010-07-12T22:37:34.760Z",
          "reference_id": "nature_2010-07-12",
          "text_tracks": [],
          "updated_at": "2010-07-12T22:54:29.666Z",
          "cue_points": [
            {
              "id": "111637107001",
              "name": "Pre-roll",
              "type": "AD",
              "time": 0,
              "metadata": null,
              "force_stop": false
            }
          ],
          "custom_fields": {
            "moretext": "this is the first video uploaded",
            "mylist": "abc"
          },
          "link": {
            "text": "Full Dvd at Amazon",
            "url": "http://www.amazon.com/Avatar-Sam-Worthington/dp/B002VPE1AW"
          },
          "tags": [
            "copied"
          ],
          "poster_sources": [
            {
              "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999"
            }
          ],
          "thumbnail_sources": [
            {
              "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999"
            }
          ],
          "poster": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999",
          "thumbnail": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999",
          "sources": [
            {
              "avg_bitrate": 379000,
              "width": 320,
              "duration": 595560,
              "size": 28196307,
              "stream_name": "mp4:107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
              "codec": "H264",
              "asset_id": "111728840001",
              "container": "MP4",
              "height": 180,
              "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
            },
            {
              "avg_bitrate": 379000,
              "width": 320,
              "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
              "size": 28196307,
              "height": 180,
              "duration": 595560,
              "container": "MP4",
              "codec": "H264",
              "asset_id": "111728840001"
            }, ... 6 more sources ...
    
          ]
        }

搜尋影片

您必須使用 啟用搜索的策略密鑰,當使用 Playback API。 有關詳細信息,請參見 Playback API 參考 文件。

參數

請注意,所有參數都是 可選。 它們適用於 GET Videos 僅請求。

獲取視頻請求參數
參數 產品描述
q 查詢字符串查詢-有關詳細信息,請參見 搜索指南
limit 要返回的視頻數量-必須為1到100之間的整數。 默認值:20
offset 要跳過的視頻數量(用於分頁結果)。 必須為正整數。 默認值:0
sort 一個字符串,指定要作為排序依據的字段。
開始 - 降序排序。
如果為 q 提供,則默認排序是按“分數”(搜索結果與原始查詢的相關性)。
如果沒有價值 q 提供,則默認排序為 updated_at 下降。
以下字段對排序有效: name, reference_id, created_at, published_at, updated_at, schedule_starts_at, schedule_ends_at, state, plays_totalplays_trailing_week
有關詳細信息,請參見 取得影片 條的規定, Playback API 參考

Brightcove的 Playback API 提供了一種編程方式來搜索您的視頻 Video Cloud 圖書館。

要對視頻數據執行基本和復雜的搜索,您將使用 q 參數:

        https://edge.api.brightcove.com/playback/v1/accounts/1752604051111/videos?q={search terms}

有關如何搜索視頻的詳細信息,請參見 搜尋影片 文件。

分頁結果

使用 limit 參數,以指定要根據請求返回的項目數-最多100。然後,您可以使用 offset 參數以瀏覽大於結果的結果集 limit。 “ offset 是要跳過的項目數。

例如,以下搜索返回總結果集中的視頻51-75,假設總結果集中至少有75個視頻:

        /videos?q=updated_at:2014-01-01..2014-06-30&limit=25&offset=50

limitoffset 參數只能用於視頻。

分頁最佳做法

在從中分頁結果集時 Playback API,建議執行以下步驟:

  1. 使用 limitoffset 參數以返回結果集中的數據組。
            /accounts/578380111111/videos?q=tags:nature&limit=20&offset=50
  2. 每次回應後,您都會看到 count 字段始終顯示結果集中視頻的最大數量。
            {"count": 171,
              "videos": [ ... ]
            }
  3. count 您的第一個請求中的視頻數量可用於確定您還需要請求多少個頁面。

    或者,您可以詢問 count 每個響應的價值,並持續到 count 小於或等於頁面大小乘以 limit.
            count <= page-number * limit

排序視頻結果

使用參數 sort=field_name 指定結果的排序方式。 您可以對以下視頻字段進行排序:[1-1]

  • 名稱
  • reference_id
  • created_at
  • 已發布
  • Updated_at
  • schedule_starts_at(注意:這是 分類 領域- 搜索字段是 schedule.starts_at)
  • schedule_ends_at(注意:這是 分類 領域- 搜索字段是 schedule.ends_at)
  • plays_total[1-2]
  • play_trailing_week[1-2]

筆記

  • [1-1] 如果您沒有為視頻搜索通話提供排序值,則結果將按相關性排序。 如果您不提供 GET 視頻通話,結果將按以下順序排序 updated_at 下降。
  • [1-2] 你可以排序 plays_total or plays_trailing_week,但這些字段未包含在結​​果中

所有視頻和大數據集

如果您要檢索帳戶中的所有視頻或大量視頻,則必須注意以下幾點:

  1. 您可能會嘗試使用允許的最大容量 limit (100),但最好以25或更少的批次檢索視頻,以最大程度地減少API請求超時的可能性
  2. 在翻閱大型數據集時,可能會在操作期間更新視頻數據,這可能會導致項目的響應發生偏移:
    • 您可能會在連續的頁面上看到重複的項目
    • 某項可能已丟失,因為它已轉移到先前的響應集

    要考慮第一種可能性,在完成視頻檢索後,您的應用應該對整個項目列表進行重複數據刪除。 要處理第二種可能性,您需要將(重複數據刪除後)檢索到的項目總數與期望的數目進行比較,然後重新運行請求,並按last_modified_date(降序)對結果進行排序-您不需要檢索多個批次以撿拾丟失的物品。

  3. 您可以通過對返回的結果進行適當的排序來降低上一項目中出現這種情況的可能性。 默認排序方式 相關性 for search是基於一種複雜的算法,該算法查找關鍵字,標籤和自定義字段值的組合。 如果您要搜索基於多個關鍵字,標籤和/或自定義字段的視頻,則按相關性排序正是您想要的。 但是,如果您只是嘗試檢索全部或大量視頻,請設置 sort 參數顯式將使您可以更好地控制返回項目的順序。

取得影片

端點

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/videos

        https://edge.api.brightcove.com/playback/v1/accounts/57838016001/videos?q=tags:nature,name:nature

樣品回复

        {
          "count": 123,
          "videos":
            [
              {<video1 fields>},
              {<video2 fields>},
              ...
            ]
        }

錯誤回應

如果您嘗試將“獲取視頻”端點與未啟用搜索功能的策略密鑰一起使用,您將從以下位置收到以下錯誤消息: Playback API:

        [
          {
            "api_call": "search",
            "error_subcode": "API",
            "error_code": "ACCESS_DENIED",
            "message": "Access to this resource is forbidden by access policy."
          }
        ]

Playback API 允許您在帳戶中搜索與指定視頻相關的視頻。 基於 nameshort description 在指定視頻中,API將在以下字段中搜索部分匹配項:

  • name
  • short description
  • long description
  • tags

如果地理位置限制生效,則可能不會收到整頁的結果。

參數

以下URL參數可用於GET相關視頻請求:

GET相關視頻請求參數
參數 產品描述
limit 要返回的視頻數(默認= 20;最大= 100)
ad_config_id 附加您的ad_config_id以返回 帶有SSAI的視頻

默認情況下,響應最多包含20個視頻。 您可以使用 limit 參數最多可返回100個視頻,但會增加延遲。

請注意,沒有 offset 查找相關視頻時的參數,因此您將無法翻閱視頻結果。

使用視頻ID獲取相關視頻

端點

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/videos/{video_id}/related

        https://edge.api.brightcove.com/playback/v1/accounts/1752604059001/videos/5565662146001/related

使用參考ID獲取相關視頻

端點

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/videos/ref:{reference_id}/related

        https://edge.api.brightcove.com/playback/v1/accounts/1752604059001/videos/ref:nature/related

樣品回复

在下面的響應中,請注意沒有 count 領域,不像 搜索視頻 響應。

        {
          "videos":
            [
              {<video1 fields>},
              {<video2 fields>},
              ...
            ]
        }

錯誤回應

如果您嘗試通過未啟用搜索的策略密鑰來使用與查找相關的端點,則將從以下站點收到以下錯誤消息: Playback API:

        [
          {
            "api_call": "search",
            "error_subcode": "API",
            "error_code": "ACCESS_DENIED",
            "message": "Access to this resource is forbidden by access policy."
          }
        ]

使用SSAI的視頻請求

即使您沒有使用Brightcove網站 player 或應用程序中的Brightcove本機SDK,您仍然可以將服務器端廣告插入(SSAI)與自己的 player.

使用SSAI獲取視頻

要返回具有SSAI的視頻,請將廣告配置ID作為URL參數附加到您的 Playback API 請求。 通過此請求,您可以使用視頻ID或視頻參考ID。

具有URL參數的端點

追加您的 ad_config_id 到最後 Playback API 請求:

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/videos/{video_id}?ad_config_id={ad_config_id}

        https://edge.api.brightcove.com/playback/v1/accounts/1752604059001/videos/5565662146001?ad_config_id=1234abcd

在下面的示例響應中,您將注意到以下內容:

  • 如果您未添加廣告配置ID,則響應類似於。
  • 的要素 sources 數組將包含一個名為 vmap.
  • 如果您想知道廣告在內容中的位置,可以閱讀鏈接中的VMAP文件 vmap 屬性。
  • src 內的財產 sources 數組將包含指向HLS或DASH源的URL。 這與未使用廣告配置ID時的響應相同,但是 src 廣告將與主要內容結合在一起。

樣品回复

        {
          "description": "The story of a giant rabbit with a heart bigger than himself. ",
          "poster_sources": [
            {
              "src": "https://cf-images.us-east-1.prod.boltdns.net/v1/jit/3723496277001/dd5bd69c-e962-4a43-9dbd-94faaaba1785/main/1280x720/5m17s130ms/match/image.jpg"
            }
          ],
          "tags": [],
          "cue_points": [],
          "custom_fields": {},
          "account_id": "3723496277001",
          "sources": [
            {
              "ext_x_version": "4",
              "vmap": "http://ssaiplayback.prod.boltdns.net/playback/once/v1/vmap/hls/v4/clear/3723496277001/7a3316d9-1b06-4d62-bec8-3919b43fffbb/dd5bd69c-e962-4a43-9dbd-94faaaba1785/content.vmap?bc_token=NTllMTMxYjNfMTdkOTY2YThhNjU5MDk5ZTQ3NDBkNmUxOTYyOGRkNzM0ZjBiM2RjMGEwOThjOGFkYjk1MWQxMzFmNGYzMjA5YQ%3D%3D",
              "type": "application/x-mpegURL",
              "src": "http://ssaiplayback.prod.boltdns.net/playback/once/v1/hls/v4/clear/3723496277001/7a3316d9-1b06-4d62-bec8-3919b43fffbb/dd5bd69c-e962-4a43-9dbd-94faaaba1785/master.m3u8?bc_token=NTllMTMxYjNfZGM5ZDg0NGM2ZGJjZDcxZTFjOGYyODBlMzM2NmNmMmJkMWNhZDczNWViNzRiMjIwNjg5MjkzZGM0ZmJlMTc1Yw%3D%3D"
            },
            ...
          ],
          "created_at": "2017-05-15T17:09:11.171Z"
        }

需要ad_config_id

使用 Policy API,您可以創建一個策略密鑰,要求您包括 ad_config_id 向發出請求時的網址參數 Playback API。 有關設置此功能的詳細信息,請參見 Policy API 參考 文件。

當策略密鑰設置為要求 ad_config_id,並且您不會將其附加到 Playback API 請求,您將收到以下錯誤:

        [
          {
            "error_subcode": "AD_CONFIG",
            "error_code": "ACCESS_DENIED",
            "message": "Missing required ad_config_id parameter"
          }
        ]

播放清單要求

可以使用播放列表ID或其參考ID來檢索播放列表視頻對象。

參數

以下網址參數可用於播放列表請求

播放列表請求參數
參數 產品描述
限制 要返回的視頻數(默認= 20;最大= 100)
抵消 要跳過的視頻數(從播放列表的開頭;默認= 0)

例如,這些附加到您請求中的參數-limit = 40&offset = 20-會返回播放列表中的視頻21-60(假設有很多)。

通過ID獲取播放列表

端點

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/playlists/{playlist_id}

        https://edge.api.brightcove.com/playback/v1/accounts/57838016001/playlists/38467382999

樣品回复

        {
          "account_id": "107767373999",
          "created_at": "2010-07-12T22:43:30.290Z",
          "description": null,
          "id": "111592530001",
          "name": "Play One",
          "reference_id": null,
          "type": "EXPLICIT",
          "updated_at": "2010-07-12T22:51:25.055Z",
    
          "videos": [
            {
              "description": "Avatar_MakingAScene_Featurette",
              "poster_sources": [
                {
                  "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999"
                }
              ],
              "tags": [
                "copied"
              ],
              "cue_points": [
                {
                  "id": "111637107001",
                  "name": "Pre-roll",
                  "type": "AD",
                  "time": 0,
                  "metadata": null,
                  "force_stop": false
                }
              ],
              "custom_fields": {
                "moretext": "this is the first video uploaded",
                "mylist": "abc"
              },
              "account_id": "107767373999",
              "sources": [
                {
                  "avg_bitrate": 379000,
                  "width": 320,
                  "duration": 595560,
                  "size": 28196307,
                  "stream_name": "mp4:107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728840001",
                  "container": "MP4",
                  "height": 180,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 379000,
                  "width": 320,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 28196307,
                  "height": 180,
                  "duration": 595560,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728840001"
                },
                {
                  "avg_bitrate": 267000,
                  "width": 320,
                  "duration": 595560,
                  "size": 19894997,
                  "stream_name": "mp4:107767373999/107767373999_111728852001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728852001",
                  "container": "MP4",
                  "height": 180,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 267000,
                  "width": 320,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728852001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 19894997,
                  "height": 180,
                  "duration": 595560,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728852001"
                },
                {
                  "avg_bitrate": 549000,
                  "width": 480,
                  "duration": 595567,
                  "size": 40889436,
                  "stream_name": "mp4:107767373999/107767373999_111728860001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728860001",
                  "container": "MP4",
                  "height": 268,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 549000,
                  "width": 480,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728860001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 40889436,
                  "height": 268,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728860001"
                },
                {
                  "avg_bitrate": 835000,
                  "width": 640,
                  "duration": 595567,
                  "size": 62142992,
                  "stream_name": "mp4:107767373999/107767373999_111728865001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728865001",
                  "container": "MP4",
                  "height": 360,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 835000,
                  "width": 640,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728865001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 62142992,
                  "height": 360,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728865001"
                },
                {
                  "avg_bitrate": 1744000,
                  "width": 640,
                  "duration": 595567,
                  "size": 129836869,
                  "stream_name": "mp4:107767373999/107767373999_111735357001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111735357001",
                  "container": "MP4",
                  "height": 360,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 1744000,
                  "width": 640,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111735357001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 129836869,
                  "height": 360,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111735357001"
                },
                {
                  "avg_bitrate": 1249000,
                  "width": 640,
                  "duration": 595567,
                  "size": 92994065,
                  "stream_name": "mp4:107767373999/107767373999_111735369001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111735369001",
                  "container": "MP4",
                  "height": 360,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 1249000,
                  "width": 640,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111735369001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 92994065,
                  "height": 360,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111735369001"
                }
              ],
              "name": "Avatar_MakingAScene_Featurette",
              "reference_id": "AvatarMakingShort",
              "long_description": null,
              "duration": 595560,
              "published_at": "2010-07-12T22:37:34.760Z",
              "text_tracks": [],
              "updated_at": "2010-07-12T22:54:29.666Z",
              "thumbnail": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999",
              "poster": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999",
              "link": {
                "text": "Full Dvd at Amazon",
                "url": "http://www.amazon.com/Avatar-Sam-Worthington/dp/B002VPE1AW"
              },
              "id": "38467382999",
              "ad_keys": null,
              "thumbnail_sources": [
                {
                  "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999"
                }
              ],
              "created_at": "2010-07-12T22:37:34.760Z"
            }
          ],
        }

通過參考ID獲取播放列表

端點

        https://edge.api.brightcove.com/playback/v1/accounts/{account_id}/playlists/ref:{reference_id}

        https://edge.api.brightcove.com/playback/v1/accounts/57838016001/playlists/ref:nature_2010-07-12

樣品回复

        {
          "account_id": "107767373999",
          "created_at": "2010-07-12T22:43:30.290Z",
          "description": null,
          "id": "111592530001",
          "name": "Play One",
          "reference_id": nature_2010-07-12,
          "type": "EXPLICIT",
          "updated_at": "2010-07-12T22:51:25.055Z",
    
          "videos": [
            {
              "description": "Avatar_MakingAScene_Featurette",
              "poster_sources": [
                {
                  "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999"
                }
              ],
              "tags": [
                "copied"
              ],
              "cue_points": [
                {
                  "id": "111637107001",
                  "name": "Pre-roll",
                  "type": "AD",
                  "time": 0,
                  "metadata": null,
                  "force_stop": false
                }
              ],
              "custom_fields": {
                "moretext": "this is the first video uploaded",
                "mylist": "abc"
              },
              "account_id": "107767373999",
              "sources": [
                {
                  "avg_bitrate": 379000,
                  "width": 320,
                  "duration": 595560,
                  "size": 28196307,
                  "stream_name": "mp4:107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728840001",
                  "container": "MP4",
                  "height": 180,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 379000,
                  "width": 320,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728840001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 28196307,
                  "height": 180,
                  "duration": 595560,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728840001"
                },
                {
                  "avg_bitrate": 267000,
                  "width": 320,
                  "duration": 595560,
                  "size": 19894997,
                  "stream_name": "mp4:107767373999/107767373999_111728852001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728852001",
                  "container": "MP4",
                  "height": 180,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 267000,
                  "width": 320,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728852001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 19894997,
                  "height": 180,
                  "duration": 595560,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728852001"
                },
                {
                  "avg_bitrate": 549000,
                  "width": 480,
                  "duration": 595567,
                  "size": 40889436,
                  "stream_name": "mp4:107767373999/107767373999_111728860001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728860001",
                  "container": "MP4",
                  "height": 268,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 549000,
                  "width": 480,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728860001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 40889436,
                  "height": 268,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728860001"
                },
                {
                  "avg_bitrate": 835000,
                  "width": 640,
                  "duration": 595567,
                  "size": 62142992,
                  "stream_name": "mp4:107767373999/107767373999_111728865001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111728865001",
                  "container": "MP4",
                  "height": 360,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 835000,
                  "width": 640,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111728865001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 62142992,
                  "height": 360,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111728865001"
                },
                {
                  "avg_bitrate": 1744000,
                  "width": 640,
                  "duration": 595567,
                  "size": 129836869,
                  "stream_name": "mp4:107767373999/107767373999_111735357001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111735357001",
                  "container": "MP4",
                  "height": 360,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 1744000,
                  "width": 640,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111735357001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 129836869,
                  "height": 360,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111735357001"
                },
                {
                  "avg_bitrate": 1249000,
                  "width": 640,
                  "duration": 595567,
                  "size": 92994065,
                  "stream_name": "mp4:107767373999/107767373999_111735369001_Avatar-MakingAScene-Featurette.mp4?__nn__=1497926354001&slist=107767373999/&auth=daEciavcicRbhbtdSaBdBdVbXd0aUdTcMaX-bvRrSa-hca-slyCzrux_zJAq_HFCB_EvE&aifp=bcosuds",
                  "codec": "H264",
                  "asset_id": "111735369001",
                  "container": "MP4",
                  "height": 360,
                  "app_name": "rtmp://cp150446.edgefcs.net/ondemand"
                },
                {
                  "avg_bitrate": 1249000,
                  "width": 640,
                  "src": "http://uds.ak.o.brightcove.com/107767373999/107767373999_111735369001_Avatar-MakingAScene-Featurette.mp4?pubId=107767373999&videoId=38467382999",
                  "size": 92994065,
                  "height": 360,
                  "duration": 595567,
                  "container": "MP4",
                  "codec": "H264",
                  "asset_id": "111735369001"
                }
              ],
              "name": "Avatar_MakingAScene_Featurette",
              "reference_id": "AvatarMakingShort",
              "long_description": null,
              "duration": 595560,
              "published_at": "2010-07-12T22:37:34.760Z",
              "text_tracks": [],
              "updated_at": "2010-07-12T22:54:29.666Z",
              "thumbnail": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999",
              "poster": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728861001_vs-111727994001.jpg?pubId=107767373999&videoId=38467382999",
              "link": {
                "text": "Full Dvd at Amazon",
                "url": "http://www.amazon.com/Avatar-Sam-Worthington/dp/B002VPE1AW"
              },
              "id": "38467382999",
              "ad_keys": null,
              "thumbnail_sources": [
                {
                  "src": "http://brightcove04.o.brightcove.com/107767373999/107767373999_111728862001_th-111727994001.jpg?pubId=107767373999&videoId=38467382999"
                }
              ],
              "created_at": "2010-07-12T22:37:34.760Z"
            }
          ],
        }

標題

隱藏字幕為希望訪問它的個人提供了有關您的視頻的其他信息。 字幕對於聾啞人和聽力障礙者來說是必不可少的,以訪問視頻的音頻部分。 如果您不熟悉字幕,請參閱 概述:向視頻添加字幕 文件。

外部WebVTT

外部WebVTT字幕是與視頻分開的文本文件。 您可以將字幕文件與視頻相關聯,如下所示:

樣品回复

以下是來自 Playback API 使用“媒體”模塊將WebVTT字幕文件添加到視頻的位置。 請注意,文本軌道 src 屬性指向外部字幕文件。

        {
        "text_tracks": [
        {
          "mime_type": null,
          "account_id": "20318290001",
          "default": true,
          "sources": [
            {
              "src": "https://static.3playmedia.com/p/files/2240988/threeplay_transcripts/6418302.vtt?project_id=10127&format_id=51&refresh=1515241856"
            }
          ],
          "src": "https://static.3playmedia.com/p/files/2240988/threeplay_transcripts/6418302.vtt?project_id=10127&format_id=51&refresh=1515241856",
          "asset_id": null,
          "label": "English",
          "id": "13d66def-d004-4e75-b160-4ac693eff7d7",
          "kind": "captions",
          "srclang": "en"
        }
        ],
        }

清單內WebVTT

影片中會包含清單內的WebVTT字幕。 可以在第一次攝取視頻時或攝取視頻後完成。 您可以按以下方式創建清單內字幕:

樣品回复

以下是來自 Playback API 使用以下命令將WebVTT字幕文件添加到視頻中 Dynamic Ingest API。 請注意,文本軌道 src 屬性指向內部Brightcove文件。

        {
        "text_tracks": [
        {
          "mime_type": "text/webvtt",
          "account_id": "1752604059001",
          "default": false,
          "sources": [
            {
              "src": "http://bcboltbde696aa-a.akamaihd.net/media/v1/text/vtt/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf/text.vtt?akamai_token=exp=1518032480~acl=/media/v1/text/vtt/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf/text.vtt*~hmac=5aa9f206a8e970efb4cab95278e2e9b16a29b3ccf82951a91245352d9149b173"
            },
            {
              "src": "https://bcboltbde696aa-a.akamaihd.net/media/v1/text/vtt/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf/text.vtt?akamai_token=exp=1518032480~acl=/media/v1/text/vtt/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf/text.vtt*~hmac=5aa9f206a8e970efb4cab95278e2e9b16a29b3ccf82951a91245352d9149b173"
            }
            ],
          "src": "http://bcboltbde696aa-a.akamaihd.net/media/v1/text/vtt/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf/text.vtt?akamai_token=exp=1518032480~acl=/media/v1/text/vtt/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf/text.vtt*~hmac=5aa9f206a8e970efb4cab95278e2e9b16a29b3ccf82951a91245352d9149b173",
          "asset_id": null,
          "label": "EN",
          "id": "92cb36a7-c836-4506-a87f-f649316c0cdf",
          "kind": "captions",
          "in_band_metadata_track_dispatch_type": "",
          "srclang": "en"
        }
        ],
        }

表現

HLS或DASH視頻文件的清單還包含必要的信息,以包含WebVTT字幕。

HLS
        #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-0",NAME="en (Main)",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="https://manifest.prod.boltdns.net/manifest/v1/hls/v4/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/8b12c808-c5ea-47f3-abfa-c23b023db297/10s/rendition.m3u8?fastly_token=NWE3YjU3ZThfNzAwNTczOWM4MWQ4Mzk2NjFkYjVjYmFhYjQwNzY2MWUzM2MyNDM5ZDA5ZGExYTFkMzRmYzA0MDdhOTlmZWJhMw%3D%3D"
        #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles-0",NAME="EN",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="https://manifest.prod.boltdns.net/manifest/v1/hls/v4/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf/rendition.m3u8?fastly_token=NWE3YjU3ZThfNDYzOThkZGJiZTU1NTlhOTdkYzA5OTA3M2UzZGRlYTgzMmRkZmUxMGIxYTJkY2Y5ZDQ1ODFiNTEyMmNiZDVhMw%3D%3D"
        #EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=519200,CODECS="mp4a.40.2,avc1.420015",RESOLUTION=480x270,AUDIO="audio-0",CLOSED-CAPTIONS=NONE,SUBTITLES="subtitles-0"
        https://manifest.prod.boltdns.net/manifest/v1/hls/v4/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/5f7850d9-9a65-4eee-8810-86a1e18e05fb/10s/rendition.m3u8?fastly_token=NWE3YjU3ZThfY2Q5YmE2ODc2OWFiNTgyZjUxMjc1MzRhNmQxMzA0ZmJmY2RlMGU4ZjBiNDExZGRmNjc3YjQ0OGQ5N2RiOTVmMA%3D%3D
        
短跑
        <AdaptationSet mimeType="text/vtt" lang="en">
        <Representation bandwidth="256" id="92cb36a7-c836-4506-a87f-f649316c0cdf">
          <BaseURL>http://bcboltbde696aa-a.akamaihd.net/media/v1/dash/live/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a/92cb36a7-c836-4506-a87f-f649316c0cdf.vtt?akamai_token=exp=1518032494~acl=/media/v1/dash/live/clear/1752604059001/3585c49a-5a95-4783-8625-e3af727d094a*~hmac=3e2edc412c273f1255f2c18bbbcee7afc6a2edb74573f9295b0f05feda69f0e2</BaseURL>
        </Representation>
        </AdaptationSet>

頁面最後更新於12年2020月XNUMX日