很抱歉问了这么简单的问题。
我已经苦苦挣扎了几天。
因为谷歌的api文档真的是最烂的。
这就是我现在的样子。
有了 GoogleSignIn,OAuth 就完成了。 (它有用户 ID、 token 和 API key 等信息……)
成功获取播放列表
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;
};
}
- 如何开始直播??
我认为这是一个愚蠢的问题。
但我真的很绝望。
https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/insert
根据此文档,必须为这些属性指定一个值。
- snippet.title
- snippet.scheduledStartTime
- status.privacyStatus
还有一部分是必需的参数。
“part 参数在此操作中有两个用途。它标识写入操作将设置的属性以及 API 响应将包含的属性。
您可以在参数值中包含的部分属性有 id、snippet、contentDetails 和 status。”
但这到底是什么?详细信息??状态??片段?? 我在文档的任何地方都找不到此信息。 我不知道该怎么办。 请帮助我。
最佳答案
基于此文档:
- 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.
- The
status
object contains information about the video's uploading, processing, and privacy statuses.
- The
snippet
object contains basic details about the video, such as its title, description, and category.
您需要提供一个 liveBroadcast resource在请求正文中。您也可以查看此 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
关于ios - 快速的 YouTube 直播 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53809966/