Getting an embed code or link to a video
Written by
Updated at November 25, 2024
Cloud Video interface
REST API
gRPC API
-
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 this 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 this 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.