我们正在更新 Data API,以便与 YouTube 统计 Shorts 短视频观看次数的方式保持一致。
了解详情
Watermarks
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
watermark
资源用于标识在指定频道的视频播放期间显示的图片。您还可以指定图片将链接到的目标频道,以及确定水印在视频播放期间的显示时间和显示时长的时间详细信息。
方法
该 API 支持以下针对 watermarks
资源的方法:
- set
- 将水印图片上传到 YouTube 并为频道设置该水印。
- unset
- 删除频道的视频水印图片。
立即试用。
属性
下表定义了此资源中显示的属性:
属性 |
timing |
object
timing 对象封装了有关频道的水印图片将在视频播放期间的哪个时间点显示的信息。 |
timing.type |
string
一种时间安排方法,用于确定水印图片在视频播放期间的显示时间。如果值为 offsetFromStart ,则 offsetMs 字段表示相对于视频开始时间的偏移量。如果值为 offsetFromEnd ,则 offsetMs 字段表示与视频结尾的偏移量。 |
timing.offsetMs |
unsigned long
时间偏移量(以毫秒为单位),用于确定在视频播放期间何时显示推广的商品。type 属性的值决定了偏移量是从视频的开头还是结尾开始计算的。 |
timing.durationMs |
unsigned long
水印图片应显示的时长(以毫秒为单位)。 |
position |
object
position 对象封装了视频中将显示水印图像的空间位置的相关信息。 |
position.type |
string
在视频播放器中放置推广商品的样式。
此属性的有效值为: |
position.cornerPosition |
string
播放器中显示促销内容的角落。该项始终显示在播放器的右上角。
此属性的有效值为: |
imageUrl |
string
频道的水印图片网址。YouTube 将生成此网址,并在对 watermark.set 请求的 API 响应中返回该网址。 |
imageBytes |
bytes
水印图片的大小(以字节为单位)。 |
targetChannelId |
string
水印图片所链接到的频道的 YouTube 频道 ID。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eA watermark resource displays an image during a channel's video playbacks, with the option to link to a target channel.\u003c/p\u003e\n"],["\u003cp\u003eThe API provides \u003ccode\u003eset\u003c/code\u003e and \u003ccode\u003eunset\u003c/code\u003e methods to upload and delete watermark images respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003etiming\u003c/code\u003e object controls when a watermark appears, using \u003ccode\u003etype\u003c/code\u003e to determine if it's measured from the start or end of a video and \u003ccode\u003eoffsetMs\u003c/code\u003e for the time offset, with \u003ccode\u003edurationMs\u003c/code\u003e defining its display length.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eposition\u003c/code\u003e object defines the watermark's location within the video, with \u003ccode\u003ecornerPosition\u003c/code\u003e specifically determining the corner.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003etargetChannelId\u003c/code\u003e property is used to indicate the YouTube channel ID that the image links to when interacted with.\u003c/p\u003e\n"]]],["A watermark resource is an image displayed during a channel's video playbacks. Key actions include setting a watermark by uploading an image and specifying its `targetChannelId` for linking. The `timing` object defines when the image appears using `type`, `offsetMs`, and `durationMs`. The `position` object, set to 'corner', determines the spatial location, specifically `topRight`. Watermarks can be removed using the `unset` method. The API response provides an `imageUrl` and `imageBytes`.\n"],null,["# Watermarks\n\nA **watermark** resource identifies an image that displays during playbacks of a specified channel's videos. You can also specify a target channel to which the image will link as well as timing details that determine when the watermark appears during video playbacks and the length of time it is visible.\n\nMethods\n-------\n\nThe API supports the following methods for `watermarks` resources:\n\n[set](/youtube/v3/docs/watermarks/set)\n: Uploads a watermark image to YouTube and sets it for a channel.\n\n[unset](/youtube/v3/docs/watermarks/unset)\n: Deletes a channel's watermark image.\n [Try it now](/youtube/v3/docs/watermarks/unset#try-it).\n\nResource representation\n-----------------------\n\nThe JSON structure below shows the format of a `watermarks` resource: \n\n```carbon\n{\n \"#timing\": {\n \"#timing.type\": string,\n \"#timing.offsetMs\": unsigned long,\n \"#timing.durationMs\": unsigned long\n },\n \"#position\": {\n \"#position.type\": string,\n \"#position.cornerPosition\": string\n },\n \"#imageUrl\": string,\n \"#imageBytes\": bytes,\n \"#targetChannelId\": string\n}\n```\n\n### Properties\n\nThe following table defines the properties that appear in this resource:\n\n| Properties ||\n|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `timing` | `object` The `timing` object encapsulates information about the time during a video playback when a channel's watermark image will display. |\n| timing.`type` | `string` The timing method that determines when the watermark image is displayed during the video playback. If the value is `offsetFromStart`, then the `offsetMs` field represents an offset from the start of the video. If the value is `offsetFromEnd`, then the `offsetMs` field represents an offset from the end of the video. |\n| timing.`offsetMs` | `unsigned long` The time offset, specified in milliseconds, that determines when the promoted item appears during video playbacks. The `type` property's value determines whether the offset is measured from the start or end of the video. |\n| timing.`durationMs` | `unsigned long` The length of time, in milliseconds, that the watermark image should display. |\n| `position` | `object` The `position` object encapsulates information about the spatial position within the video where the watermark image will display. |\n| position.`type` | `string` The manner in which the promoted item is positioned in the video player. Valid values for this property are: - corner |\n| position.`cornerPosition` | `string` The corner of the player where the promoted item will appear. The item always appears in the upper right corner of the player. Valid values for this property are: - `topRight` |\n| `imageUrl` | `string` The URL for the channel's watermark image. YouTube will generate this URL and return it in the API response to a `watermark.set` request. |\n| `imageBytes` | `bytes` The size of the watermark image, in bytes. |\n| `targetChannelId` | `string` The YouTube channel ID of the channel that the watermark image links to. |"]]