YouTube Live Streaming API - 瞭解廣播與串流服務
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本指南提供廣播和直播的簡介。也會探討相關使用情境,說明電視台如何使用 YouTube Live Streaming API 建立及管理這些資源。
後續章節將說明 API 使用者一般使用廣播和串流的三種用途。
設定單一編碼器
以最常見的 API 用途來說,您的 YouTube 頻道已推出一系列已排定或週期性的現場直播。身為頻道擁有者,你使用的是單一編碼器,且只想設定一次編碼器。因此,您執行下列步驟:
- 在 API 中建立一項
liveStream
資源。
- 使用該項資源的內容上傳設定,即可設定頻道的編碼器。
請注意,如果你有多個頻道,就必須為每個頻道個別建立直播。
- 在 API 中建立
liveBroadcast
資源,並將所有資源繫結至 liveStream
資源。在這種情況下,您為頻道安排的所有現場直播都會使用相同的串流設定。不過,無論何時都只有一個事件進行直播,且每場廣播的影片內容都是獨一無二的。
- 在事件發生時,將廣播狀態更新為
testing
或 live
,然後在 YouTube 上播送該活動。
為每個廣播建立單一串流
另一種常見的做法是為每則直播建立個別的串流。在這個情況下,您必須為每個 liveBroadcast
資源建立不同的 liveStream
資源,然後調整串流編碼器,針對每個廣播訊息使用適當的設定。
如果頻道有多則週期性直播,因此兩個直播可能會同時發生,導致兩個直播無法使用相同的直播設定,應該採取這個做法。事實上,頻道可以將每則週期性直播視為節目,並為每個節目只建立一項 liveStream
資源。然後,同一節目的每一集都代表一個廣播,且同一節目的所有廣播都可以繫結至同一個串流。
使用一個串流同時建立多個串流
在這個情況下,你想將直播分成多場同步直播。因此,您有一項 liveStream
資源,繫結至同時具有 live
狀態的兩項 (或多項) liveBroadcast
資源。
舉例來說,假設您的頻道播送了全天候的即時影像,但您還想為本次的訪談影片另外製作一部影片。在這個案例中,訪談內容是全天候播出內容的一部分。
如要處理這種情況,請建立兩項 liveBroadcast
資源,並將兩個廣播訊息繫結至同一個串流。正在進行 24 小時全年無休的廣播,且資源在面試開始前便處於 live
狀態。訪談開始後,你將訪談相關資源的狀態更新為 live
,不會變更全天候廣播節目的資源。因此,您同時將相同的內容串流至兩部不同的影片。
訪談結束後,您會再次更新採訪直播的資源,這次將狀態設為 complete
。不過,影片串流仍會持續播放,
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-15 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-08-15 (世界標準時間)。"],[[["A broadcast represents a live event on YouTube, functioning as a distinct video, and it must be linked to one stream."],["A stream is used to send audio-video content to YouTube, defining the settings for that stream, and one stream can be connected to up to three live broadcasts."],["Broadcasters often use the same stream for numerous broadcasts that occur at different times, reusing stream settings and reducing redundant setup."],["The API can be used in multiple ways, whether it be one stream for multiple broadcasts, one stream per broadcast, or a single stream being split into multiple simultaneous broadcasts."],["Channels can use the API to schedule recurring live events with a single encoder, configuring it just once for multiple broadcasts."]]],["Broadcasts represent distinct YouTube live events, each bound to one stream. Streams transmit audio-video content to YouTube and define streaming settings. Broadcasters often reuse streams for multiple broadcasts at different times. Common use cases include: configuring one stream for multiple scheduled broadcasts, creating a unique stream per broadcast, or using a single stream for simultaneous broadcasts. For the last case, one stream can be used to have up to 3 simultaneous live broadcasts. API users create and bind these resources.\n"]]