Introduction
Microsoft has introduced new APIs for working with video portals. The hierarchy of the information storage will be:
- Video portal is present in Office 365 instance.
- Video portal consists of the channels.
- Channels in turn consist of many videos.
Retrieve Video Portal Details
The API is used to get the video portal information from “https://siteurl/_api/VideoService.Discover”. The properties which can be accessed from this operation are video site page URL, channel template URL, player template URL and video site URL.
The following code snippet shows the JQuery Ajax call to get the video portal information from the Office 365 site.
- $.ajax
- ({
- url: "/_api/VideoService.Discover",
- type: "GET",
- headers: { "accept": "application/json;odata=verbose" },
- success: function(data)
- {
- var videoSiteInfo = data.d;
- console.log("Video Site Page URL : " + videoSiteInfo.O365VideoPageUrl);
- console.log("Video Channel URL : " + videoSiteInfo.ChannelUrlTemplate);
- console.log("Player URL : " + videoSiteInfo.PlayerUrlTemplate);
- console.log("Video Site URL : " + videoSiteInfo.VideoPortalUrl);
- },
- error: function(data){
- }
- });
Retrieve Channels
On the video portal, you can start creating the channels. The channels are used to categorize the videos. Creating channels literally means you are going to create site collections.
To get the channels from the video portal, the video portal URL should be used with REST Video API to pull the information. The REST API URL will be https://videositeurl/_api/VideoService/Channels. Here, the video site URL is the component which we have identified in the section above.
Next, we will see how we can retrieve the information about a particular channel. Identify the channel and get the channel ID manually or by using the previous operation. The operation will be very similar to the one shown above. The only difference is Channel ID, which is passed to get the particular channel information.
https://videositeurl/_api/VideoService/Channels('Channel-GUID')
- $.ajax
- ({
- url: "/portals/hub/_api/VideoService/Channels", // Pass Channel id to get particular channel info
- type: "GET",
- headers: { "accept": "application/json;odata=verbose" },
- success: function(data)
- {
- var channelInfo = data.d.results[0]; // First Channel
- console.log("channel Name : " + channelInfo.Title);
- console.log("channel URL : " + channelInfo.ServerRelativeUrl);
- // Similarly other properties can be retrieved
- },
- error: function(data){
- }
- });
Retrieve Videos from Channels
https://videositeurl/_api/VideoService/Channels('Channel-GUID')/Videos
The operation will fetch us all the videos from the channel, using the <for each> loop through the result set to get the details of each video. The properties which can be viewed are file name, video URL, author details, video download URL, view count, thumbnail URL, duration, video uploaded date and the channel details.
Now, we will see how we can retrieve particular video details. This is again similar to the above operation. Once you identify the video ID, you can pass it using a query to SharePoint, along with the channel ID, to get more information about the single video. The same set of properties will be retrieved here. The REST Video API will be available at the link provided below:
https://videositeurl/_api/VideoService/Channels('Channel-GUID')/Videos('Video-GUID')
- $.ajax
- ({
- url: "/portals/hub/_api/VideoService/Channels('Channel-GUID')/Videos",
- type: "GET",
- async: false,
- headers: { "accept": "application/json;odata=verbose" },
- success: function(data)
- {
- var videoInfo = data.d.results[0]; // First Video
- console.log("Video Name : " + videoInfo.FileName);
- console.log("Video URL : " + videoInfo.Url);
- // Similarly other properties can be retrieved
- },
- error: function(data){
- }
- });

Santhakumar MunuswamyPosted Jun 25, 2016, 2:22 AM
Nice share
Prasham SabadraPosted Jun 17, 2016, 2:34 PM
Thanks for Sharing!!!
Vignesh ManiPosted Jun 17, 2016, 5:32 AM
Nice
RajaPosted Jun 17, 2016, 12:49 AM
Good One...
Debasis SahaPosted Jun 17, 2016, 12:47 AM
Nice one..