Getting an embed code or link to a video
-
Open the Cloud Video home page
. -
Select a channel.
-
In the
Video tab, select the video. -
Under Past code:
-
Set the required playback parameters for the video:
Play video without sound by default (recommended)
Auto play video
Display controls in the player
.
With Cloud Video Player SDK for IFrame, you can specify additional video player management settings and video playback parameters for the HTML page, such as video size and looping, volume, etc.
-
Select the preferred video link format:
html
: HTML embed code in Iframe format.link
: Direct link to the video.
-
Click
Copy.
-
Run the following command:
curl \
--request GET \
--header 'Authorization: Bearer <IAM_token>' \
--url 'https://video.api.cloud.yandex.net/video/v1/videos/<video_ID>:getPlayerURL'
Where:
<IAM_token>
: IAM token required for authenticating with the Cloud Video API.<video_ID>
: ID of the video you want to get a link to.
Result:
{
"playerUrl": "https://runtime.video.cloud.yandex.net/player/video/vplva3626rvh********?autoplay=0\u0026mute=0",
"html": "\u003ciframe width=\"560\" height=\"315\" src=\"https://runtime.video.cloud.yandex.net/player/video/vplva3626rvh********?autoplay=0\u0026mute=0\" allow=\"autoplay; fullscreen; accelerometer; gyroscope; picture-in-picture; encrypted-media\" frameborder=\"0\" scrolling=\"no\"\u003e\u003c/iframe\u003e"
}
Where:
playerUrl
: Direct link to the video.html
: HTML embed code in Iframe format.
Run the following command:
grpcurl \
-rpc-header "Authorization: Bearer <IAM_token>" \
-d '{
"videoId": "<video_ID>"
}' \
video.api.cloud.yandex.net:443 yandex.cloud.video.v1.VideoService/GetPlayerURL
Where:
<IAM_token>
: IAM token required for authenticating with the Cloud Video API.<video_ID>
: ID of the video you want to get a link to.
Result:
{
"playerUrl": "https://runtime.video.cloud.yandex.net/player/video/vplva3626rvh********?autoplay=0\u0026mute=0",
"html": "\u003ciframe width=\"560\" height=\"315\" src=\"https://runtime.video.cloud.yandex.net/player/video/vplva3626rvh********?autoplay=0\u0026mute=0\" allow=\"autoplay; fullscreen; accelerometer; gyroscope; picture-in-picture; encrypted-media\" frameborder=\"0\" scrolling=\"no\"\u003e\u003c/iframe\u003e"
}
Where:
playerUrl
: Direct link to the video.html
: HTML embed code in Iframe format.
Tip
To make the whole thumbnail fit in the window regardless of screen resolution when uploading the video in browser, add the &object_fit=contain
parameter to the end of the link.
If this parameter is not specified in the link, the default object_fit=cover
value will be used.
For more information about the object_fit
parameter, see the CSS documentation