ycyoon
ycyoon

Reputation: 187

Detect 360 degree video on YouTube

Is there any method that find out whether a YouTube video type is spherical(360 degree) or not?

For 360 degree video, the YouTube video player shows an arrow key stick on left-upper side. Is it possible to notice that by looking at the HTML code?

I'm carefully looking at the html code of 360 video, but can't find any sign of it.

Upvotes: 1

Views: 956

Answers (2)

EugeneButusov
EugeneButusov

Reputation: 11

To recognise what video your player is playing (360 or plain), there are two ways.

1. Direct querying to YouTube API.

You can simply query by this URL:

https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,status&id=<YOUR_VIDEO_ID>&key=<YOUR_API_KEY>&alt=json

To obtain an API key, you must visit this page to check guide if you haven't it yet: https://developers.google.com/youtube/v3/getting-started. In the response, you should read the value contentDetails.projection as defined there: https://developers.google.com/youtube/v3/docs/videos#contentDetails.projection.

2. Indirect guess of video format.

First way is doing additional HTTP call which may beat performance, so we can use this way also. Iframe API Player has .getSphericalProperties(), which will be empty object if there is rectangular (plain) video presented, but will have something like {yaw: 0, pitch: 0, roll: 0, fov: 100.00004285756798}, if you're using 360 video.

Upvotes: 1

Green swirly thing
Green swirly thing

Reputation: 9

I've checked, and there is no difference in the link from the usual, both having the watch?v= format and both using an eleven digit code for the video's unique link. The only three ways of know is by watching the actual video and testing if it is 3D yourself, reading the comments or looking at the title (most 360 degree videos say that they are in the title).

Upvotes: 1

Related Questions