swift 中的 YouTube 直播 API

YouTube Live Streaming API in swift

很抱歉问了这么简单的问题。
苦恼了几天
因为Googleapi文档真的是最差的

我现在是这样的。

  1. 使用Google登录,OAuth 就完成了。 (里面有用户ID,token,还有API key...)

  2. 成功获取播放列表


func fetchPlaylist(id: String) {
    let url = self.baseURL + "/playlists"
    let params = ["part": "snippet", "id": id, "key": self.apiKey]

    Alamofire.request(url, method: .get, parameters: params, encoding: URLEncoding.default, headers: nil).responseJSON { (response) in
        if let response = response.result.value {
            print(response)
        } else {
            print("error")
        }
    }
}
//////////// result
{
    etag = "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/ewwRz0VbTYpp2EGbOkvZ5M_1mbo\"";
    items =     (
    );
    kind = "youtube#playlistListResponse";
    pageInfo =     {
        resultsPerPage = 5;
        totalResults = 0;
    };
}
  1. 如何开始直播??
    我认为这是一个愚蠢的问题。
    但是我真的很绝望。

https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/insert

根据此文档,必须为这些属性指定一个值。

还有部分需要的参数。

"part 参数在此操作中有两个用途。它标识写入操作将设置的属性以及 API 响应将包括的属性。

您可以在参数值中包含的部分属性是 id、snippet、contentDetails 和 status。

但这到底是什么东西?详细信息??地位??片段?? 我在文档的任何地方都找不到此信息。 我不知道该怎么办。 请帮助我。

基于此文档:

contentDetails

  • The contentDetails object contains information about the video content, including the length of the video and an indication of whether captions are available for the video.

status

  • The status object contains information about the video's uploading, processing, and privacy statuses.

snippet

  • The snippet object contains basic details about the video, such as its title, description, and category.

您需要提供一个liveBroadcast resource in the request body. You may also check this link作为示例。

YTLiveStreaming

YTLiveStreaming is a framework for creating live broadcasts and video streams on YouTube using the YouTube Live Streaming API (YouTube Data API v3) in Swift 4