- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们将 YouTube Live Streaming API 与 Google API PHP Client 结合使用我无法弄清楚如何使用基本(预设)摄取而不是自定义摄取。
自定义的没问题,但出于某种原因,即使您将它们命名为相同的名称,它也会不断为您创建的每个流创建重复项。
所以我的问题是,我们如何让它使用基本摄取或能够选择自定义摄取而不每次都创建新摄取?
例如,以下是您在 YouTube 帐户中手动设置流时可以选择的基本摄取:
相关 PHP 代码:
// Create an object for the liveBroadcast resource's snippet. Specify values
// for the snippet's title, scheduled start time, and scheduled end time.
$broadcastSnippet = new Google_Service_YouTube_LiveBroadcastSnippet();
$broadcastSnippet->setTitle($this->title);
$broadcastSnippet->setDescription($this->desc);
$broadcastSnippet->setScheduledStartTime($this->start_time);
// Create an object for the liveBroadcast resource's status, and set the
// broadcast's status.
$status = new Google_Service_YouTube_LiveBroadcastStatus();
$status->setPrivacyStatus($this->privacy_status);
// Create the API request that inserts the liveBroadcast resource.
$broadcastInsert = new Google_Service_YouTube_LiveBroadcast();
$broadcastInsert->setSnippet($broadcastSnippet);
$broadcastInsert->setStatus($status);
$broadcastInsert->setKind('youtube#liveBroadcast');
// Execute the request and return an object that contains information
// about the new broadcast.
$broadcastsResponse = $this->youtube->liveBroadcasts->insert('snippet,status', $broadcastInsert, array());
// Create an object for the liveStream resource's snippet. Specify a value
// for the snippet's title.
$streamSnippet = new Google_Service_YouTube_LiveStreamSnippet();
$streamSnippet->setTitle($this->stream_title);
// Create an object for content distribution network details for the live
// stream and specify the stream's format and ingestion type.
$cdn = new Google_Service_YouTube_CdnSettings();
# TODO: Update the below `Format` method to use the new 'resolution' and 'frameRate' methods
$cdn->setFormat($this->format);
$cdn->setIngestionType('rtmp');
// Create the API request that inserts the liveStream resource.
$streamInsert = new Google_Service_YouTube_LiveStream();
$streamInsert->setSnippet($streamSnippet);
$streamInsert->setCdn($cdn);
$streamInsert->setKind('youtube#liveStream');
// Execute the request and return an object that contains information
// about the new stream.
$streamsResponse = $this->youtube->liveStreams->insert('snippet,cdn', $streamInsert, array());
// Bind the broadcast to the live stream.
$bindBroadcastResponse = $this->youtube->liveBroadcasts->bind(
$broadcastsResponse['id'], 'id,contentDetails',
array(
'streamId' => $streamsResponse['id'],
));
最佳答案
我不确定您所说的“基本摄取”是什么意思。根据 API,唯一可设置的摄取属性是 cdn.ingestionType
目前仅支持 RTMP 摄取。
您在 Web 门户中看到的编码器设置等效于 cdn.format
值,提供了一个界面来为您的直播选择比特率-分辨率对。此属性已于 2016 年 4 月 18 日弃用,取而代之的是两个新属性: cdn.frameRate
和 cdn.resolution
. Web 门户中列出的比特率值是每个分辨率的推荐比特率,由您的编码器配置,而不是 API。
正确设置自定义 cdn
格式不应导致重复的 Live Stream 对象。您的代码中其他地方可能存在错误。如果你觉得这是一个API缺陷,我建议你给Google开一张票here .
关于youtube - 在使用 YouTube Live Streaming API 时使用基本摄取或避免重复的自定义摄取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36965048/
我有这个 json 模式 { "name":"Pete" "age":24, "subjects":[ { "name":"maths" "grade":"
测量海浪周期的变量的“单位”属性以“秒”为单位。这不是日期时间字段,但 xarray 会自动将此变量作为 timedelta64 摄取。由于单位不是“自...以来的秒数”,我会假设 xarray 应该
我尝试使用 geomesa-accumulo 摄取 geotiff 数据,但出现以下错误: WARNING: Failed to load the GDAL native libs. This is
我有一个很大的 JSON 字符串,包含 10 条记录,每条记录都有自己的属性。我需要使用 Javascript 将它们提取到我的 MongoDB 中。我对 Javascript 基本上没什么用,谷歌也
在谈到 MongoDB 时,我完全是个新手,但我以前确实有使用 Hbase 和 Accumulo 等 nosql 存储的经验。当我使用这些其他 nosql 平台时,我最终编写了自己的数据摄取框架(通常
我正在尝试为我正在开发的应用构建我自己的客户端 RTMP 库。到目前为止,一切都非常成功,因为我能够连接到 RTMP 服务器协商握手,然后发送所有必要的数据包(FCPublish Publish ET
我将 pandas 与 pandera 一起用于模式验证,但我遇到了一个问题,因为数据中有一个空整数列。 from prefect import task, Flow #type:i
我将 pandas 与 pandera 一起用于模式验证,但我遇到了一个问题,因为数据中有一个空整数列。 from prefect import task, Flow #type:i
我无法在网络服务中正确读取输入 JSON 文件。我正在尝试将一些输入参数从简单的字符串更改为字符串数组 我的输入 JSON 看起来像这样: { "inputParams" : { "speck
Snowflake 建议在摄取之前拆分大文件: To optimize the number of parallel operations for a load, we recommend aimin
我可以在linux中成功执行以下命令: ffmpeg -i "rtmp://42.62.95.48/live?vhost=hls/livestream timeout=2" -vcodec copy
您好,我需要从数据库中读取多个表并连接这些表。一旦表加入,我想将它们推送到 Elasticsearch。 这些表是从外部进程连接的,因为数据可以来自多个源。这不是问题,事实上我有 3 个单独的进程以平
如何根据 Kafka 消息中的消息类型使用水槽写入自定义 hdfs 目录? 说 kafka 消息:{"type": "A", "data": "blah"} 在类型字段中有 "A"应该写入 /data
我正在寻找一种方法,使 Google DataFlow 作业在(特定)异常发生时停止从 Pub/Sub 摄取。 来自 Pub/Sub 的事件是通过 PubsubIO.Read.Bound 读取的 JS
我运行了一个 docker-compose up,我在我的 golang 容器上收到一条错误消息,提示“Error establishing Mongo session”,然后容器退出。我不确定问题是
我是一名优秀的程序员,十分优秀!